dev_forum
daiao 5 years ago
commit bc41dbebc6

@ -93,7 +93,8 @@ class MyshixunsController < ApplicationController
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
t1 = Time.now t1 = Time.now
jsonTestDetails = JSON.parse(params[:jsonTestDetails].to_json) Rails.logger.info("@@@222222#{params[:jsonTestDetails]}")
jsonTestDetails = JSON.parse(params[:jsonTestDetails])
timeCost = JSON.parse(params[:timeCost]) timeCost = JSON.parse(params[:timeCost])
brige_end_time = Time.parse(timeCost['evaluateEnd']) if timeCost['evaluateEnd'].present? brige_end_time = Time.parse(timeCost['evaluateEnd']) if timeCost['evaluateEnd'].present?
return_back_time = format("%.3f", ( t1.to_f - brige_end_time.to_f)).to_f return_back_time = format("%.3f", ( t1.to_f - brige_end_time.to_f)).to_f
@ -212,10 +213,10 @@ class MyshixunsController < ApplicationController
end end
uid_logger("training_task_status start#4**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}") uid_logger("training_task_status start#4**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
sucess_status sucess_status
rescue Exception => e # rescue Exception => e
tip_exception(e.message) # tip_exception(e.message)
uid_logger_error("training_task_status error: #{e}") # uid_logger_error("training_task_status error: #{e}")
raise ActiveRecord::Rollback # raise ActiveRecord::Rollback
end end
end end
end end

@ -301,8 +301,8 @@ module.exports = {
}, },
warnings: false, warnings: false,
compress: { compress: {
drop_debugger: true, drop_debugger: false,
drop_console: true drop_console: false
} }
} }
}), }),

@ -2,7 +2,7 @@ import React from "react";
import axios from 'axios'; import axios from 'axios';
import { requestProxy } from "./indexEduplus2RequestProxy"; import { requestProxy } from "./indexEduplus2RequestProxy";
import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString} from 'educoder'; import { broadcastChannelOnmessage ,SetAppModel} from 'educoder';
import { notification } from 'antd'; import { notification } from 'antd';
import './index.css' import './index.css'
broadcastChannelOnmessage('refreshPage', () => { broadcastChannelOnmessage('refreshPage', () => {
@ -18,19 +18,10 @@ function locationurl(list){
} }
// TODO 开发期多个身份切换 // TODO 开发期多个身份切换
let debugType = "" const debugType =""
if (isDev) { // window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
const _search = window.location.search; // window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin'
let parsed = {}; // window._debugType = debugType;
if (_search) {
parsed = queryString.parse(_search);
}
debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
window.location.search.indexOf('debug=s') != -1 ? 'student' :
window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || ''
}
window._debugType = debugType;
export function initAxiosInterceptors(props) { export function initAxiosInterceptors(props) {
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation // TODO 避免重复的请求 https://github.com/axios/axios#cancellation
@ -121,7 +112,7 @@ export function initAxiosInterceptors(props) {
// https://github.com/axios/axios/issues/583 // https://github.com/axios/axios/issues/583
// message.info(response.data.message || '服务端返回status -1请联系管理员。'); // message.info(response.data.message || '服务端返回status -1请联系管理员。');
// props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' ) // props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' )
if (window.location.pathname.startsWith('/tasks/')) { if (window.location.pathname.startsWith('/tasks/')) {
props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' ) props.showSnackbar( response.data.message || '服务器异常,请联系管理员。' )
} else { } else {
notification.open({ notification.open({
@ -136,7 +127,7 @@ export function initAxiosInterceptors(props) {
// description: response.data.message || '服务器异常,请联系管理员。', // description: response.data.message || '服务器异常,请联系管理员。',
// }); // });
} }
throw new axios.Cancel('Operation canceled by the user.'); throw new axios.Cancel('Operation canceled by the user.');
} }
// if(response.data.status === 401){ // if(response.data.status === 401){

@ -147,6 +147,8 @@ class Addcourses extends Component{
if(Addcoursestype===true){ if(Addcoursestype===true){
this.props.hideAddcoursestype(); this.props.hideAddcoursestype();
}else{
window.location.href = "/";
} }
} }

@ -88,11 +88,11 @@ class CoursesNew extends Component {
} }
componentDidUpdate(prevProps){ componentDidUpdate(prevProps){
if(prevProps.current_user!=this.props.current_user){ // if(prevProps.current_user!=this.props.current_user){
if(this.props.current_user.user_identity==="学生"){ // if(this.props.current_user.user_identity==="学生"){
window.location.href ="/403" // window.location.href ="/403"
} // }
} // }
} }
onChangeTimepublishs = (date, dateString) => { onChangeTimepublishs = (date, dateString) => {
if(dateString===""){ if(dateString===""){
@ -132,7 +132,7 @@ class CoursesNew extends Component {
e.preventDefault(); e.preventDefault();
let coursesId = this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
let {is_public} = this.state let {is_public,datatime} = this.state
// console.log(is_public) // console.log(is_public)
if (coursesId != undefined) { if (coursesId != undefined) {
@ -173,7 +173,7 @@ class CoursesNew extends Component {
// console.log('Received values of form: ', values); // console.log('Received values of form: ', values);
let {datatime} = this.state;
let url = "/courses/" + coursesId + ".json"; let url = "/courses/" + coursesId + ".json";
axios.put(url, { axios.put(url, {
course_list_name: values.course, course_list_name: values.course,
@ -227,7 +227,7 @@ class CoursesNew extends Component {
// debugger // debugger
//新建 //新建
// console.log('Received values of form: ', values); // console.log('Received values of form: ', values);
let {datatime} = this.state;
let url = "/courses.json"; let url = "/courses.json";
axios.post(url, { axios.post(url, {
course_list_name: values.course, course_list_name: values.course,

@ -382,7 +382,7 @@ class ShixunhomeWorkItem extends Component{
<a className="btn colorblue font-16" href={"/shixuns/"+discussMessage.shixun_identifier+"/challenges"} target={"_blank"}>实训详情</a> <a className="btn colorblue font-16" href={"/shixuns/"+discussMessage.shixun_identifier+"/challenges"} target={"_blank"}>实训详情</a>
{this.props.isAdminOrCreator()?<a onClick={()=>this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名</a>:""} {this.props.isAdminOrCreator()?<a onClick={()=>this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名</a>:""}
{/*<WordsBtn className="btn colorblue ml20 font-16" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings?tab=3`} > 设置</WordsBtn>*/} {/*<WordsBtn className="btn colorblue ml20 font-16" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings?tab=3`} > 设置</WordsBtn>*/}
<WordsBtn className="btn colorblue font-16" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings?tab=3`} > 设置</WordsBtn> <WordsBtn className="btn colorblue font-16 ml15" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings?tab=3`} > 设置</WordsBtn>
</div>:""} </div>:""}

@ -9,7 +9,7 @@
/* z-index: 20000; */ /* z-index: 20000; */
} }
#DialogID .dialogBox { #DialogID .dialogBox {
width: 402px; width: 400px;
} }
.MuiPaper-elevation24-45{ .MuiPaper-elevation24-45{
box-shadow:none !important; box-shadow:none !important;
@ -24,7 +24,7 @@
top: 0px !important; top: 0px !important;
} }
#log_reg_content{ #log_reg_content{
width:400px !important; width:405px !important;
border-radius:6px; border-radius:6px;
box-shadow:4px 8px 12px rgba(76,76,76,0.3); box-shadow:4px 8px 12px rgba(76,76,76,0.3);
} }

@ -406,7 +406,7 @@ class Trialapplication extends Component {
top: 0px !important; top: 0px !important;
} }
#log_reg_content{ #log_reg_content{
width:400px !important; width:405px !important;
border-radius:40px !important; border-radius:40px !important;
box-shadow:4px 8px 12px rgba(76,76,76,0.3); box-shadow:4px 8px 12px rgba(76,76,76,0.3);
} }

@ -424,7 +424,7 @@ class Trialapplicationysl extends Component {
top: 0px !important; top: 0px !important;
} }
#log_reg_content{ #log_reg_content{
width:400px !important; width:405px !important;
border-radius:40px !important; border-radius:40px !important;
box-shadow:4px 8px 12px rgba(76,76,76,0.3); box-shadow:4px 8px 12px rgba(76,76,76,0.3);
} }

@ -139,7 +139,7 @@ class PathDetailIndex extends Component{
let pathid=this.props.match.params.pathId; let pathid=this.props.match.params.pathId;
let url="/paths/"+pathid+".json"; let url="/paths/"+pathid+".json";
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{
if (result.data.status == 407) { if (result.data.status == 407 || result.data.status == 401) {
return; return;
} }
if(result.data.allow_visit===true){ if(result.data.allow_visit===true){
@ -164,9 +164,11 @@ class PathDetailIndex extends Component{
let pathid=this.props.match.params.pathId; let pathid=this.props.match.params.pathId;
let url="/paths/"+pathid+".json"; let url="/paths/"+pathid+".json";
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{
if (result.data.status == 407) { // TODO 403 让后台返回status 403 比较好
if (result.data.status == 407 || result.data.status == 401) {
return; return;
} }
if(result.data.allow_visit===true){ if(result.data.allow_visit===true){
this.setState({ this.setState({
detailInfoList:result.data, detailInfoList:result.data,

@ -487,20 +487,22 @@ submittojoinclass=(value)=>{
} }
showSearchOpen=(e)=>{ showSearchOpen=(e)=>{
debugger
this.setState({ this.setState({
showSearchOpentype:true showSearchOpentype:true
}) })
e.stopPropagation(e);//阻止冒泡
} }
hideshowSearchOpen=(e)=>{ hideshowSearchOpen=(e)=>{
debugger
let {setevaluatinghides}=this.state; let {setevaluatinghides}=this.state;
if(setevaluatinghides===true){ if(setevaluatinghides===true){
this.setState({ this.setState({
showSearchOpentype:false, showSearchOpentype:false,
setevaluatinghides:false setevaluatinghides:false
}) })
e.stopPropagation(e);//阻止冒泡
} }
} }
@ -518,6 +520,7 @@ submittojoinclass=(value)=>{
} }
setevaluatinghides=()=>{ setevaluatinghides=()=>{
debugger
this.setState( this.setState(
{ {
setevaluatinghides:true setevaluatinghides:true
@ -599,6 +602,7 @@ submittojoinclass=(value)=>{
// rolearr:["",""], // rolearr:["",""],
// console.log("618"); // console.log("618");
// console.log(user_phone_binded); // console.log(user_phone_binded);
console.log(showSearchOpentype)
return ( return (
<div className="newHeader" id="nHeader" > <div className="newHeader" id="nHeader" >
@ -669,8 +673,21 @@ submittojoinclass=(value)=>{
><a href={this.props.Headertop===undefined?"":this.props.Headertop.auth}>工程认证</a></li> ><a href={this.props.Headertop===undefined?"":this.props.Headertop.auth}>工程认证</a></li>
</ul> </ul>
<style>
<div className="posi-search" id="posi-search"> {
`
.posi-searchs{
opacity: 1;
position: absolute;
top: -2px;
background: #fff;
z-index: 2;
right: -241px;
}
`
}
</style>
<div className="posi-searchs" >
<div className="search-all clearfix"> <div className="search-all clearfix">
{/*<!--<a href="javascript:void(0)" className="search-clear fl" onclick="closeSearch();">×</a>-->*/} {/*<!--<a href="javascript:void(0)" className="search-clear fl" onclick="closeSearch();">×</a>-->*/}
<div className="fl pr search-clear edu-menu-panel" style={{display: 'none'}}> <div className="fl pr search-clear edu-menu-panel" style={{display: 'none'}}>
@ -686,7 +703,9 @@ submittojoinclass=(value)=>{
{/*<input type="text" className="search-input fl" id="search-input" */} {/*<input type="text" className="search-input fl" id="search-input" */}
{/*onKeyDown={this.onKeywordSearchKeyDown} name="search_keyword" placeholder="搜索实训项目"/>*/} {/*onKeyDown={this.onKeywordSearchKeyDown} name="search_keyword" placeholder="搜索实训项目"/>*/}
{/*搜索框*/} {/*搜索框*/}
{showSearchOpentype===true?<div className={"HeaderSearch"} onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}> {showSearchOpentype===true?<div
className={"HeaderSearch"}
onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}>
<Search <Search
id={"HeaderSearchs"} id={"HeaderSearchs"}
placeholder="实践课程/翻转课堂/开发社区/交流问答" placeholder="实践课程/翻转课堂/开发社区/交流问答"
@ -901,169 +920,3 @@ submittojoinclass=(value)=>{
export default NewHeader; export default NewHeader;
// <ul id="header-nav">
// <li className="active">1{/*<%= link_to "首页", home_path %>*/}</li>
// <li>2{/*<%= link_to "精选实训", shixuns_path %>*/}</li>
// <li>3{/*<%= link_to "实训路径", subjects_path %>*/}</li>
// <li>4{/*<%= link_to "在线课堂", courses_path %>*/}</li>
// <li>5{/*<%= link_to "讨论组", forums_path %>*/}</li>
// </ul>
{/*{*/}
{/*<a href={this.props.Headertop===undefined?"":this.props.Headertop.message_url}*/}
{/*style={{display:this.props.Headertop===undefined?"none":this.props.Headertop.new_message===true?"block":"none",position:'relative'}}*/}
{/*>*/}
{/*<span className="newslight" style={{display:user!=undefined&&user.login!=""?"block":"none"}}>*/}
{/*/!*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count > 99 ? '99+'*!/*/}
{/*/!*: this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*!/*/}
{/*</span>*/}
{/*</a>*/}
{/*}*/}
{/*{ this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count>0 &&*/}
{/*<a href={this.props.Headertop===undefined?"":this.props.Headertop.message_url}>*/}
{/*<span className="newslight" style={{display:user!=undefined&&user.login!=""?"block":"none"}}>*/}
{/*/!*{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count > 99 ? '99+'*!/*/}
{/*/!*: this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}*!/*/}
{/*</span>*/}
{/*</a>}*/}
{/*{ this.props.Headertop===undefined?"":user && this.props.Headertop.unread_message_count>0 &&*/}
{/*<span style={{display:user!=undefined&&user.login!=""?"block":"none"}}>*/}
{/*<div className="edu-menu-list edu-txt-center" style={{width: '220px', top: '60px'}}>*/}
{/*<a className="font-14 padding10" style={{lineHeight: '35px'}} href={this.props.Headertop===undefined?"":this.props.Headertop.message_url} >您有*/}
{/*<span className="color-orange">{this.props.Headertop===undefined?"":this.props.Headertop.unread_message_count}</span>*/}
{/*条新消息,点击查看</a>*/}
{/*</div>*/}
{/*</span>*/}
{/*}*/}
{/*
需求消息数量
<div className="fl mr30 edu-menu-panel headIcon">
<a href={`/users/${user.login}/user_tidings`}><img src={getImageUrl(`images/educoder/icon/bell.svg`}></a>
<em className="newslight"></em>
<div className="edu-menu-list edu-txt-center" style="width:220px;top:60px">
<a className="font-14 padding10" style="line-height: 35px;" href={`/users/${user.login}/user_tidings`}>
您有<span className="color-orange">30</span>
</a>
</div>
</div>
*/}
// function loadHeader(){
// //头部导航条的----------显示搜索框
// $("#search-open").on("click",function(e){
// $(this).hide();
// // $("#header-nav").animate({opacity:"0"},1000);
// $(".posi-search").show() // animate({opacity:"1"},1000);
// $("#header-nav").css("z-index","2");
// $(".posi-search").css("z-index","3");
// $(".HeaderSearch").show();
// $(".HeaderSearch").val("");
// $(".search-input").focus();
// $(".search-all .search-content").hide();
// e.stopPropagation();//阻止冒泡
// });
// $(".HeaderSearch").on("click",function(e){
// debugger
// e.stopPropagation();//阻止冒泡
// });
//搜索框输入内容
// $("#HeaderSearchs").blur(function(e){
// closeSearch();
// e.stopPropagation();//阻止冒泡
// });
//点击页面其它(与搜索框无关的地方)都会将搜索框隐藏,所以与搜索框有关的地方需要阻止冒泡
// $("body").on("click",function(){
// closeSearch();
// });
// $(".HeaderSearch").on("input",function(e){
// $(".search-all .search-content").show();
// e.stopPropagation();//阻止冒泡
// });
//搜索
// $("#header_keyword_search").on("click", header_search);
// $("input[name='search_keyword']").on("keydown", function(event){
// var code;
// if (!event) {
// event = window.event; //针对ie浏览器
// code = event.keyCode;
// }
// else {
// code = event.keyCode;
// }
// if(code == 13) {
// header_search();
// return false;
// }
// });
// $(".search-clear").click(function(e){e.stopPropagation();});
// //切换搜索条件
// $("#searchkey li").click(function(e){
// var key=$($(this).children("a")[0]).html();
// switch (key){
// case '实训':
// $("#search_type").val('1');
// break;
// case '课堂':
// $("#search_type").val('2');
// break;
// case '用户':
// $("#search_type").val('3');
// break;
// }
// $("#searchkey").siblings(".searchkey").html(key);
// $("#searchkey").hide();
// e.stopPropagation();//阻止冒泡
// });
// //切换选择导航条
// $("#header-nav li").click(function(){
// $("#header-nav li").removeClass("active");
// $(this).addClass("active");
// });
//
//
// $(".search_history").on("click", function(){
// $("input[name='search_keyword']").val($(this).html());
// header_search();
// });
// }
//
// function header_search(reactHeaderComponnet){
// console.log(old_url)
// var keyword = $("input[name='search_keyword']").val(); // 搜索关键字
// window.location.href ="/search"+"?value="+keyword;
// // if (!reactHeaderComponnet) {
// // reactHeaderComponnet = window._header_componentHandler
// // }
// // if (!reactHeaderComponnet) {
// // var index = $("#search_type").val(); // 搜索课程/项目
// // keyword = encodeURIComponent(keyword);
// // // $.get('/users/search_shixuns_or_course',
// // // { search: keyword,
// // // index: index});
// // window.location.href = old_url+"/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index;
// //e.stopPropagation();//阻止冒泡
// // } else {
// // window.__headSearchKeyword = keyword
// // reactHeaderComponnet.props.history.push(`/shixuns`)
// // trigger('searchKeywordChange', keyword)
// // }
// }
// //头部导航条的隐藏
// function closeSearch(){
// $('#posi-search').hide();
// $("#search-open").show();
// // $(".posi-search").animate({opacity:"0"},800);
// $(".HeaderSearch").hide();
// $("#header-nav").animate({opacity:"1"},1000);
// $(".posi-search").css("z-index","2");
// $("#header-nav").css("z-index","3");
// }

@ -188,6 +188,10 @@ class InterestpageComponent extends Component {
if (response !== undefined) { if (response !== undefined) {
// this.Jumptotheinterestpage(); // this.Jumptotheinterestpage();
// window.location.href = "/" // window.location.href = "/"
if(response.data.message!==undefined){
return;
}
this.setMyEduCoderModals() this.setMyEduCoderModals()
} }

@ -189,6 +189,11 @@ class InterestpageMax extends Component {
if (response !== undefined) { if (response !== undefined) {
// this.Jumptotheinterestpage(); // this.Jumptotheinterestpage();
// window.location.href = "/" // window.location.href = "/"
if(response.data.message!==undefined){
return;
}
this.setMyEduCoderModals() this.setMyEduCoderModals()
} }

@ -262,4 +262,7 @@
.bth100{ .bth100{
width: 100px; width: 100px;
margin: 0 auto; margin: 0 auto;
}
.ant-input-affix-wrapper .ant-input-prefix, .ant-input-affix-wrapper .ant-input-suffix {
background: #ffffff!important;
} }
Loading…
Cancel
Save