Merge branch 'develop' into dev_cxt

dev_winse
cxt 6 years ago
commit 9b129e4f2c

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

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

@ -28,7 +28,7 @@ class CourseMessage < ApplicationRecord
def send_deal_tiding deal_status def send_deal_tiding deal_status
# 发送申请处理结果消息 # 发送申请处理结果消息
Tiding.create!( 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 belong_container: course, extra: content.to_i == 2 ? '9' : '7', tiding_type: 'System', status: deal_status
) )
# 将申请消息置为已处理 # 将申请消息置为已处理

@ -1,4 +1,6 @@
class Videos::BatchPublishService < ApplicationService class Videos::BatchPublishService < ApplicationService
Error = Class.new(StandardError)
attr_reader :user, :params attr_reader :user, :params
def initialize(user, params) def initialize(user, params)
@ -16,6 +18,8 @@ class Videos::BatchPublishService < ApplicationService
video = user.videos.find_by(uuid: param[:video_id]) video = user.videos.find_by(uuid: param[:video_id])
next if video.blank? || video.processing_video_apply.present? 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.title = param[:title].to_s.strip.presence || video.title
video.apply_publish video.apply_publish
video.save! video.save!

@ -17,7 +17,8 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选
end end
json.question_choices do json.question_choices do
json.array! exercise_choices.each_with_index.to_a do |a,index| 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) user_answer_b = user_answer.include?(a.id)
json.c_position (index+1) if ex_choice_random_boolean #当选项随机时,选项位置以此为准,否则不出现 json.c_position (index+1) if ex_choice_random_boolean #当选项随机时,选项位置以此为准,否则不出现
json.choice_id a.id json.choice_id a.id

@ -4,5 +4,5 @@
# Rails.application.config.session_store :active_record_store # Rails.application.config.session_store :active_record_store
# Be sure to restart your server when you modify this file. # 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

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

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

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

@ -6,7 +6,10 @@
margin-top: 90px; margin-top: 90px;
margin-bottom: 320px; margin-bottom: 320px;
} }
#yslforum_index_list {
margin-top: 20px;
margin-bottom: 320px;
}
.uploadBtn { .uploadBtn {
margin-left: 0px; margin-left: 0px;
} }

@ -526,7 +526,7 @@ class TopicDetail extends Component {
const courseId=this.props.match.params.coursesId; const courseId=this.props.match.params.coursesId;
const boardId = this.props.match.params.boardId const boardId = this.props.match.params.boardId
return ( 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>{` <style>{`
.topicDetail #forum_list .return_btn.no_mr { .topicDetail #forum_list .return_btn.no_mr {
margin-right: 1px; margin-right: 1px;

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

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

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

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

@ -71,13 +71,13 @@ class ShixunWorkDetails extends Component {
<div className="educontent"> <div className="educontent">
<p className="clearfix mt20"> <p className="clearfix mt20">
<a className="fl color-grey-9 btn colorgrey hovercolorblue" <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> </a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<a className="btn colorgrey fl hovercolorblue grey" <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} // to={"/courses/"+data&&data.course_id+"/"+this.state.shixuntypes+"/"+data&&data.homework_common_id}
> >
<span className={"color-grey-9"}>实训作业</span> <span className={"color-grey-9"}>实训作业</span>

@ -28,10 +28,10 @@ class ShixunCustomsPass extends Component {
datas.push({ datas.push({
customs:{position:item.position,subject:item.subject}, customs:{position:item.position,subject:item.subject},
taskname:{name:item.username}, 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}, evaluating: {final_score:item.final_score,all_score:item.all_score},
finishtime:item.copy_username, 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, empvalue:item.code_rate,
// adjustmentminute:asdasd // adjustmentminute:asdasd
}) })
@ -200,6 +200,9 @@ class ShixunCustomsPass extends Component {
</style> </style>
{ {
data&&data.challenge_list.map((item,key)=>{ data&&data.challenge_list.map((item,key)=>{
// console.log("203challenge_list下面的数据");
// console.log(item);
// console.log(JSON.stringify(item));
return( return(
<div key={key} className={"mb20"}> <div key={key} className={"mb20"}>
<div className="font-16 color-dark-21 ml20 mr20"> <div className="font-16 color-dark-21 ml20 mr20">
@ -213,46 +216,46 @@ class ShixunCustomsPass extends Component {
<span className={"font-14"}>{item.subject}</span> <span className={"font-14"}>{item.subject}</span>
</a> </a>
</span> </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> </p>
</div> </div>
{item.code_list.map((ite,k)=>{ {item.code_list.length===0?"":item.code_list.map((ite,k)=>{
return( return(
<div className="font-16 color-dark-21 ml20 mr20" key={k}> <div className="font-16 color-dark-21 ml20 mr20" key={k}>
<div className=" mt15"> <div className=" mt15">
<p className="clearfix pt5 pb5 codebox"> <p className="clearfix pt5 pb5 codebox">
<span className="fl"> <span className="fl">
<span className={"colorC8161D"}>{item.username}</span> <span className={"colorC8161D"}>{item.username}</span>
的代码文件 的代码文件
</span> </span>
<span className="fr"> <span className="fr">
<span className={"color-green"}>{item.copy_username}</span> <span className={"color-green"}>{item.copy_username}</span>
的代码文件 的代码文件
</span> </span>
</p> </p>
<style> <style>
{` {`
.borderccc{ .borderccc{
border:1px solid #ccc border:1px solid #ccc
} }
`} `}
</style> </style>
<div className="test-code mt20 borderccc"> <div className="test-code mt20 borderccc">
<li className="clearfix"> <li className="clearfix">
<MonacoDiffEditor <MonacoDiffEditor
height="500" height="500"
// language="javascript" // language="javascript"
original={ite.origin_content} original={ite.origin_content}
value={ ite.target_content} value={ ite.target_content}
// options={options} // options={options}
/> />
</li> </li>
</div> </div>
</div> </div>
</div> </div>
) )
})} })}
</div> </div>

Loading…
Cancel
Save