dev_hjm
jingquan huang 6 years ago
commit d833e741c9

@ -151,7 +151,7 @@ class ChallengesController < ApplicationController
def index
uid_logger("identifier: #{params}")
@challenges = Challenge.fields_for_list.where(shixun_id: @shixun.id)
@challenges = @shixun.challenges.fields_for_list
@editable = @shixun.status == 0 # before_action有判断权限如果没发布则肯定是管理人员
@user = current_user

@ -598,7 +598,7 @@ class CoursesController < ApplicationController
normal_status(0, "操作成功")
rescue => e
uid_logger_error(e.message)
tip_exception("操作失败")
tip_exception(e.message)
raise ActiveRecord::Rollback
end
end

@ -1459,7 +1459,8 @@ class HomeworkCommonsController < ApplicationController
if game_codes.count > 0
code_rate += game_codes.map(&:rate).sum / challenge.path.split("").length
end
target = game_codes.count > 0 ? game_codes[0].target_user_id : nil
logger.info("#####game_codes: #{game_codes}")
#target = game_codes.count > 0 ? game_codes[0].target_user_id : nil
# 作品完成时间
game = challenge.games.find_by(user_id: @user.id)
end_time = game.end_time
@ -1467,7 +1468,7 @@ class HomeworkCommonsController < ApplicationController
all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score).to_f
final_score = @student_work.work_challenge_score game, all_score
# 抄袭用户
copy_user = User.find_by_id(game_codes[0].target_user_id)
copy_user = User.find_by_id(game_codes[0].try(:target_user_id))
copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present?
# 代码部分
code_list = []
@ -1477,7 +1478,7 @@ class HomeworkCommonsController < ApplicationController
code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content}
end
end
# TODO: 这里本来应该前端做的,但是现在页面已经刷不开了。
{code_rate: code_rate, copy_user_id: copy_user.try(:id), end_time: end_time, final_score: final_score,
all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_user.try(:full_name),
username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position,

@ -40,6 +40,8 @@ class Users::VideosController < Users::BaseController
def batch_publish
Videos::BatchPublishService.call(observed_user, batch_publish_params)
render_ok
rescue Videos::BatchPublishService::Error => ex
render_error(ex.message)
end
private

@ -1,7 +1,6 @@
class Challenge < ApplicationRecord
# difficulty: 关卡难度: 1.简单 2.中等 3.困难
# show_type: 效果展示:-1.无效果 1.图片 2.apk/exe 3.txt 4.html 5.mp3 6.mp4
default_scope { order("challenges.position asc") }
belongs_to :shixun, :touch => true, counter_cache: true
belongs_to :user

@ -8,7 +8,7 @@ class CourseGroup < ApplicationRecord
has_many :homework_group_reviews, :dependent => :destroy
scope :by_group_ids, lambda { |ids| where(id: ids)}
validates :name, length: { maximum: 20 }
validates :name, length: { maximum: 60 }
after_create :generate_invite_code

@ -5,7 +5,7 @@ class Shixun < ApplicationRecord
# hide_code 隐藏代码窗口
# code_hidden: 隐藏代码目录
# task_pass: 跳关
has_many :challenges, dependent: :destroy
has_many :challenges, -> {order("challenges.position asc")}, dependent: :destroy
has_many :challenge_tags, through: :challenges
has_many :myshixuns, :dependent => :destroy
has_many :shixun_members, dependent: :destroy

@ -1,4 +1,6 @@
class Videos::BatchPublishService < ApplicationService
Error = Class.new(StandardError)
attr_reader :user, :params
def initialize(user, params)
@ -16,6 +18,8 @@ class Videos::BatchPublishService < ApplicationService
video = user.videos.find_by(uuid: param[:video_id])
next if video.blank? || video.processing_video_apply.present?
raise Error, '视频还未上传完成' if video.vod_uploading?
video.title = param[:title].to_s.strip.presence || video.title
video.apply_publish
video.save!

@ -17,7 +17,8 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选
end
json.question_choices do
json.array! exercise_choices.each_with_index.to_a do |a,index|
standard_answer_b = standard_answers_array.include?(a.choice_position)
#TODO: 旧版本来一个题只有一个标准答案的新版又做成了一个题有多个标准答案exercise_choice_id存放的是标准答案的位置..
standard_answer_b = standard_answers_array.join("").include?(a.choice_position.to_s)
user_answer_b = user_answer.include?(a.id)
json.c_position (index+1) if ex_choice_random_boolean #当选项随机时,选项位置以此为准,否则不出现
json.choice_id a.id

@ -274,6 +274,11 @@ class App extends Component {
// }, (error) => {
// //TODO 这里如果样式变了会出现css不加载的情况
// });
window.addEventListener('error', (event) => {
const msg = `${event.type}: ${event.message}`;
console.log(msg)
});
}
//修改登录方法
Modifyloginvalue=()=>{

@ -13,7 +13,7 @@ export function getImageUrl(path) {
export function setImagesUrl(path){
const local = 'http://47.96.87.25:48080'
let firstStr=path.substr(0,1);
console.log(firstStr);
// console.log(firstStr);
if(firstStr=="/"){
return isDev?`${local}${path}`:`${path}`;
}else{

@ -68,17 +68,21 @@ class ListPageIndex extends Component{
constructor(props) {
super(props);
this.state={
yslGuideone:null,
yslGuideone:undefined,
mysearch:undefined,
}
}
componentDidMount(){
var yslGuideone = window.localStorage.getItem('yslGuideone');
var yslGuideone = window.sessionStorage.getItem('yslGuideone');
console.log("77");
console.log(yslGuideone);
var mysearchs= this.props.location.search===""?undefined:this.props.location.search===undefined?undefined:this.props.location.search==="?exhibition=true"?true:undefined;
this.setState({
yslGuideone:yslGuideone,
mysearch:mysearchs,
})
}
//
// getleftNavid=(navid,newselectnavid)=>{
@ -88,34 +92,44 @@ class ListPageIndex extends Component{
// navttype:newselectnavid
// })
// }
setwindowlocal=(bool)=>{
window.localStorage.setItem('yslGuideone', bool);
componentWillUnmount(){
window.sessionStorage.setItem('yslGuideone', false);
}
setwindowlocal=(bool)=>{
window.sessionStorage.setItem('yslGuideone', bool);
this.setState({
yslGuideone:bool,
})
mysearch:undefined,
});
var currenturl = this.props.location.pathname;
var newUrl = (currenturl.split("?"))[0];
window.history.pushState('','',newUrl);
}
render() {
let {yslGuideone} =this.state;
let {yslGuideone,mysearch} =this.state;
// console.log("98");
// console.log(yslGuideone);
// console.log(this.props.isAdmin());
// // var yslGuideones = window.sessionStorage.getItem('yslGuideone');
// console.log(this.props);
// console.log(this.props.location.search);
return (
<div>
<div className="newMain clearfix">
{/*头部banner*/}
<CoursesBanner {...this.props}></CoursesBanner>
{/*{yslGuideone===null||yslGuideone===undefined||yslGuideone===false?*/}
{/* (*/}
{/* this.props.isAdmin()===true?*/}
{/* <Guide*/}
{/* setwindowlocal={(b)=>this.setwindowlocal(b)}*/}
{/* >*/}
{/* </Guide>*/}
{/* :""*/}
{/* )*/}
{/* :""*/}
{/*}*/}
{mysearch!==undefined?
(
mysearch===true?
<Guide
setwindowlocal={(b)=>this.setwindowlocal(b)}
>
</Guide>
:""
)
:""
}
<div className="educontent clearfix" style={{flex: "1 0 auto"}}>
<div className="stud-class-set">

@ -1,12 +1,15 @@
.edu-class-container {
width: 1200px;
margin: 10px auto 20px;
}
#forum_index_list {
margin-top: 90px;
margin-bottom: 320px;
}
.uploadBtn {
margin-left: 0px;
.edu-class-container {
width: 1200px;
margin: 10px auto 20px;
}
#forum_index_list {
margin-top: 90px;
margin-bottom: 320px;
}
#yslforum_index_list {
margin-top: 20px;
margin-bottom: 320px;
}
.uploadBtn {
margin-left: 0px;
}

@ -526,7 +526,7 @@ class TopicDetail extends Component {
const courseId=this.props.match.params.coursesId;
const boardId = this.props.match.params.boardId
return (
<div className="edu-back-white edu-class-container edu-position course-message topicDetail" id="forum_index_list"> {/* fl with100 */}
<div className="edu-back-white edu-class-container edu-position course-message topicDetail" id="yslforum_index_list"> {/* fl with100 */}
<style>{`
.topicDetail #forum_list .return_btn.no_mr {
margin-right: 1px;

@ -278,7 +278,7 @@ class CommonWorkPost extends Component{
}
// 附件相关 START
handleChange = (info) => {
if (info.file.status === 'uploading') {
if (info.file.status === 'uploading' || info.file.status === 'done') {
let fileList = info.fileList;
this.setState({ fileList: appendFileSizeToUploadFileAll(fileList) });

@ -196,12 +196,14 @@ class NullEditor extends Component{
}
onAnswerChange = (index, itemIndex, val) => {
if (this.state.standard_answers[index]) {
this.setState(
(prevState) => ({
standard_answers : update(prevState.standard_answers
, {[index]: {$splice: [[itemIndex, 1, val]]}}),
})
)
}
}
addChildAnswer = (index) => {
this.setState(

@ -76,7 +76,7 @@ class CoursesNew extends Component {
Realnamecertification: data.authentication,
Professionalcertification:data.professional_certification,
})
this.handleSearchschool(data.school);
}).catch((error) => {
console.log(error);
})
@ -93,7 +93,9 @@ class CoursesNew extends Component {
});
this.setState({
school:user_school,
})
});
this.handleSearchschool(user_school);
}
@ -203,7 +205,9 @@ class CoursesNew extends Component {
// debugger
if (response.data.status === 0) {
// this.goback()
window.location.href=first_category_url;
window.location.href=first_category_url+"?exhibition=true";
window.sessionStorage.setItem('yslGuideone', true);
}
}).catch((error) => {
console.log(error)
@ -247,7 +251,8 @@ class CoursesNew extends Component {
).then((response) => {
if (response.status === 200) {
// this.goback
window.location.href=response.data.first_category_url;
window.location.href=response.data.first_category_url+"?exhibition=true";
window.sessionStorage.setItem('yslGuideone', true);
}
}).catch((error) => {
console.log(error)
@ -403,7 +408,9 @@ class CoursesNew extends Component {
const optionschool = this.state.searchlistscholl&&this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>);
// console.log(this.props.current_user.user_school)
// form合并了
console.log(this.state);
console.log(this.props);
console.log(this.props.current_user);
return (
<React.Fragment>

@ -21,6 +21,7 @@ class Guide extends Component {
}
componentDidMount() {
console.log("GuideGuideGuideGuide加载了")
// 1366x768
// var mywidthone=7;
@ -59,7 +60,7 @@ class Guide extends Component {
page:i,
})
if(i===7){
this.props.setwindowlocal(true);
this.props.setwindowlocal(false);
}
}
render() {

@ -71,13 +71,13 @@ class ShixunWorkDetails extends Component {
<div className="educontent">
<p className="clearfix mt20">
<a className="fl color-grey-9 btn colorgrey hovercolorblue"
onClick={()=>this.goback(1)}
href={`/courses/${data&&data.course_id}/shixun_homeworks/${data&&data.homework_common_id}`}
>
<span className={"color-grey-9"}>{data&&data.course_name}123</span>
<a className={"color-grey-9"} >{data&&data.course_name}</a>
</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<a className="btn colorgrey fl hovercolorblue grey"
onClick={this.goback}
href={`/courses/${data&&data.course_id}/shixun_homeworks/${data&&data.homework_common_id}/list?tab=0`}
// to={"/courses/"+data&&data.course_id+"/"+this.state.shixuntypes+"/"+data&&data.homework_common_id}
>
<span className={"color-grey-9"}>实训作业</span>

@ -28,10 +28,10 @@ class ShixunCustomsPass extends Component {
datas.push({
customs:{position:item.position,subject:item.subject},
taskname:{name:item.username},
openingtime:moment(item.end_time).format('YYYY-MM-DD HH:mm:ss'),
openingtime:item.end_time===null?"无":item.end_time===undefined?"无":item.end_time===""?"无":moment(item.end_time).format('YYYY-MM-DD HH:mm:ss'),
evaluating: {final_score:item.final_score,all_score:item.all_score},
finishtime:item.copy_username,
elapsedtime:moment(item.copy_end_time).format('YYYY-MM-DD HH:mm:ss'),
elapsedtime:item.copy_end_time===null?"无":item.copy_end_time===undefined?"无":item.copy_end_time===""?"无":moment(item.copy_end_time).format('YYYY-MM-DD HH:mm:ss'),
empvalue:item.code_rate,
// adjustmentminute:asdasd
})
@ -200,6 +200,9 @@ class ShixunCustomsPass extends Component {
</style>
{
data&&data.challenge_list.map((item,key)=>{
// console.log("203challenge_list下面的数据");
// console.log(item);
// console.log(JSON.stringify(item));
return(
<div key={key} className={"mb20"}>
<div className="font-16 color-dark-21 ml20 mr20">
@ -213,46 +216,46 @@ class ShixunCustomsPass extends Component {
<span className={"font-14"}>{item.subject}</span>
</a>
</span>
<span className="fr codeboxright">代码文件{item.code_list[0].path}</span>
<span className="fr codeboxright">代码文件{item.code_list.length===0?"无":item.code_list[0].path===undefined?"无":item.code_list[0].path}</span>
</p>
</div>
{item.code_list.map((ite,k)=>{
{item.code_list.length===0?"":item.code_list.map((ite,k)=>{
return(
<div className="font-16 color-dark-21 ml20 mr20" key={k}>
<div className=" mt15">
<p className="clearfix pt5 pb5 codebox">
<span className="fl">
<span className={"colorC8161D"}>{item.username}</span>
的代码文件
</span>
<span className="fr">
<span className={"color-green"}>{item.copy_username}</span>
的代码文件
</span>
</p>
<style>
{`
.borderccc{
border:1px solid #ccc
}
`}
</style>
<div className="test-code mt20 borderccc">
<li className="clearfix">
<MonacoDiffEditor
height="500"
// language="javascript"
original={ite.origin_content}
value={ ite.target_content}
// options={options}
/>
</li>
</div>
</div>
</div>
<div className="font-16 color-dark-21 ml20 mr20" key={k}>
<div className=" mt15">
<p className="clearfix pt5 pb5 codebox">
<span className="fl">
<span className={"colorC8161D"}>{item.username}</span>
的代码文件
</span>
<span className="fr">
<span className={"color-green"}>{item.copy_username}</span>
的代码文件
</span>
</p>
<style>
{`
.borderccc{
border:1px solid #ccc
}
`}
</style>
<div className="test-code mt20 borderccc">
<li className="clearfix">
<MonacoDiffEditor
height="500"
// language="javascript"
original={ite.origin_content}
value={ ite.target_content}
// options={options}
/>
</li>
</div>
</div>
</div>
)
})}
</div>
@ -267,4 +270,4 @@ class ShixunCustomsPass extends Component {
}
}
export default ShixunCustomsPass;
export default ShixunCustomsPass;

Loading…
Cancel
Save