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

dev_hjm
杨树林 6 years ago
commit e2e8421f14

@ -1336,7 +1336,7 @@ class HomeworkCommonsController < ApplicationController
shixun = @homework.shixuns.take
# 通过代码文件来判断语言
language = shixun.challenges.practice_type.pluck(:path).first
language = language.split("")[0].split(".")[1].downcase if language.present?
language = language.split("")[0].split(".").last.downcase if language.present?
user_lists = []
if language.present? && (language == "java" || language == "py")
user_ids = @course.course_members.where(course_group_id: params[:group_ids]).distinct(:user_id).pluck(:user_id)

@ -81,6 +81,7 @@ class SubjectsController < ApplicationController
def show
@user = current_user
@is_creator = current_user.creator_of_subject?(@subject)
@is_manager = @user.manager_of_subject?(@subject)
# 合作团队
@members = @subject.subject_members.includes(:user)
@shixuns = @subject.shixuns.published.pluck(:id)

@ -103,6 +103,10 @@ module StudentWorksHelper
# 对结果进行排序
efficiency_list =
results.sort {|x, y| x[:efficiency] <=> y[:efficiency]}.each_with_index.map do |result, index|
if result[:user_id] == work.user.id
myself_eff = [index+1, result[:efficiency]]
myself_object = [result[:consume_time], result[:eff_score], result[:round_size]]
end
[index + 1, result[:efficiency], result[:user_id]]
end

@ -28,7 +28,7 @@ class CourseMessage < ApplicationRecord
def send_deal_tiding deal_status
# 发送申请处理结果消息
Tiding.create!(
user_id: course_message_id, trigger_user: 1, container_id: course_id, container_type: 'DealCourse',
user_id: course_message_id, trigger_user_id: 1, container_id: course_id, container_type: 'DealCourse',
belong_container: course, extra: content.to_i == 2 ? '9' : '7', tiding_type: 'System', status: deal_status
)
# 将申请消息置为已处理

@ -263,9 +263,9 @@ class User < ApplicationRecord
course&.course_members.exists?(user_id: id)
end
# 实训路径管理员创建者或admin
# 实训路径管理员
def creator_of_subject?(subject)
subject.user_id == id || admin?
subject.user_id == id
end
# 实训路径合作者、admin

@ -5,15 +5,16 @@ json.challenges_count @subject.subject_challenge_count
json.subject_score @subject.all_score
json.member_count @subject.member_count
json.allow_delete @is_creator && (@subject.status != 2 || @user.admin?)
json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin?
json.publish_status publish_status(@subject, @is_creator, @user, @shixuns)
json.allow_statistics @user.manager_of_subject?(@subject)
json.allow_statistics @is_manager
json.allow_send @user.logged?
json.allow_visit @user.manager_of_subject?(@subject) || @user.admin? || @subject.status > 1
json.allow_add_member @user.manager_of_subject?(@subject)
json.allow_visit @subject.status > 1 || @is_manager
json.allow_add_member @is_manager
json.members @members do |member|
json.partial! 'subject_member', locals: { user: member.user }
json.role member.role
end
# 技能标签

@ -4,5 +4,5 @@
# Rails.application.config.session_store :active_record_store
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cache_store, :expire_after => 10.hours, key: '_educoder_session', domain: :all
Rails.application.config.session_store :cache_store, :expire_after => 24.hours, key: '_educoder_session', domain: :all

File diff suppressed because one or more lines are too long

@ -64,3 +64,4 @@ export { default as ImageLayerHook } from './hooks/ImageLayerHook'
// 外部
export { default as CBreadcrumb } from '../modules/courses/common/CBreadcrumb'
export { CNotificationHOC as CNotificationHOC } from '../modules/courses/common/CNotificationHOC'

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { SnackbarHOC } from 'educoder';
import { SnackbarHOC, CNotificationHOC } from 'educoder';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
@ -55,4 +55,4 @@ class Index extends Component{
)
}
}
export default SnackbarHOC() ( TPMIndexHOC(Index) );
export default CNotificationHOC() (SnackbarHOC() ( TPMIndexHOC(Index) ));

@ -171,7 +171,9 @@ class DetailCards extends Component{
delecttype:false,
editdelectid:undefined
})
this.getPathCardsList();
// this.getPathCardsList();
this.updatapathCardsedit()
}
}).catch((error) => {
console.log(error)

@ -112,6 +112,10 @@ class PathDetailIndex extends Component{
this.setState({
Modalstype:false,
})
// TODO 这个是临时处理,还需要优化,这里要看怎么区分处理
if (this.state.Modalstopval == '你确定要删除该成员吗?') {
return;
}
this.props.history.goBack()
}
@ -248,11 +252,12 @@ class PathDetailIndex extends Component{
let param={user_id:user_id};
axios.delete(url,{data:param}).then((response) => {
if(response.data.status===1){
this.props.showNotification(response.data.message)
this.setState({
Modalstype:true,
Modalstopval:response.data.message,
loadtype:true,
cardsModalsave:this.cardsModalsave,
Modalstype:false,
// Modalstopval:response.data.message,
loadtype:false,
// cardsModalsave:this.cardsModalsave,
})
this.updatadetailInfoList();
}
@ -479,8 +484,10 @@ class PathDetailIndex extends Component{
<div className="fl ml15 flex1">
<p className="mb10 mt5">{item.name}
{/* 新增role 判断是否能删除 1 管理员 2 合作者 */}
{
detailInfoList===undefined?"":detailInfoList.allow_add_member===true?
detailInfoList===undefined?"":detailInfoList.allow_add_member===true && item.role == 2?
<a className="fr" onClick={()=>this.shanchuallow(item.id)}><i className="iconfont icon-shanchu color-grey-c font-14 font-n"></i></a>:""
}
</p>

@ -576,7 +576,7 @@ class Collaborators extends Component {
{/*</span>*/}
</p>
<p className="color-grey-B2 task-hide">{item.user.brief_introduction}</p>
{/* <p className="color-grey-B2 task-hide">{item.user.brief_introduction}</p> */}
</div>

@ -327,17 +327,18 @@ class Infos extends Component{
</div>
</div>
<div className="mt15 educontent clearfix edu-txt-center">
<p className="mb20" style={{"height": "28px"}}>
{sign && <p className="mb20" style={{"height": "28px"}}>
{/* 这家伙很懒,什么都没留下~ */}
{
is_edit && is_current ?
<input type="text" id="mysign" class="mysign-input" placeholder="请输入您的个性签名" style={{height:"20px"}} value={sign} onInput={this.inputSign} onBlur={this.savemysign}/>
:
is_current ?
<a className="mysign-span" onClick={this.editmysign} style={{"display": "block"}}>{sign || "这家伙很懒,什么都没留下~"}</a>
<a className="mysign-span" onClick={this.editmysign} style={{"display": "block"}}>{sign || ""}</a>
:
<span className="mysign-span" style={{"display": "block","cursor":"default"}}>{sign || "这家伙很懒,什么都没留下~"}</span>
<span className="mysign-span" style={{"display": "block","cursor":"default"}}>{sign || ""}</span>
}
</p>
</p>}
{
is_current ?
<div className="inline">

Loading…
Cancel
Save