diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 81e9402b9..cf7ac6d2e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -187,15 +187,32 @@ class ApplicationController < ActionController::Base # 系统全局认证 def check_auth - if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) - tip_exception(408, "您的试用申请正在审核中,请耐心等待") - elsif current_user.certification != 1 - day_cer = UserDayCertification.find_by(user_id: current_user.id) - tip_exception(407, "系统未授权") unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 - elsif !current_user.profile_completed? - info_url = '/account/profile' - tip_exception(402, info_url) + day_cer = UserDayCertification.find_by(user_id: current_user.id) + # 如果注册超过24小时则需要完善资料及授权 + if (Time.now.to_i - day_cer.try(:created_at).to_i) > 86400 + if !current_user.profile_completed? + info_url = '/account/profile' + tip_exception(402, info_url) + elsif current_user.certification != 1 + if current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) + tip_exception(408, "您的试用申请正在审核中,请耐心等待") + end + tip_exception(407, "系统未授权") + end end + + + # if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) + # tip_exception(408, "您的试用申请正在审核中,请耐心等待") + # elsif (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 + # if !current_user.profile_completed? + # info_url = '/account/profile' + # tip_exception(402, info_url) + # elsif current_user.certification != 1 + # day_cer = UserDayCertification.find_by(user_id: current_user.id) + # tip_exception(407, "系统未授权") unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 + # end + # end end def start_user_session(user) diff --git a/public/react/src/App.js b/public/react/src/App.js index d7aa0a540..db6b6f43b 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -13,10 +13,11 @@ import '@icedesign/base/dist/ICEDesignBase.css'; import '@icedesign/base/index.scss'; -import LoginDialog from './modules/login/LoginDialog' -import Notcompletedysl from './modules/user/Notcompletedysl' -import Trialapplicationysl from './modules/login/Trialapplicationysl' -import Trialapplicationreview from './modules/user/Trialapplicationreview' +import LoginDialog from './modules/login/LoginDialog'; +import Notcompletedysl from './modules/user/Notcompletedysl'; +import Trialapplicationysl from './modules/login/Trialapplicationysl'; +import Trialapplicationreview from './modules/user/Trialapplicationreview'; +import Addcourses from "./modules/courses/coursesPublic/Addcourses"; import Trialapplication from './modules/login/Trialapplication' import NotFoundPage from './NotFoundPage' @@ -41,6 +42,7 @@ import {initAxiosInterceptors} from './AppConfig' // !!!tpi需要这个来加载css import {TPMIndexHOC} from './modules/tpm/TPMIndexHOC'; + const theme = createMuiTheme({ palette: { primary: { @@ -259,7 +261,7 @@ class App extends Component { render() { - // let {isRenders} = this.state; + return ( @@ -270,6 +272,7 @@ class App extends Component { + {/*{*/} {/* isRender === true?*/} {/* : ""*/} diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 0cc9fd687..8cca8205f 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -19,7 +19,7 @@ function locationurl(list){ // TODO 开发期多个身份切换 const debugType =window.location.search.indexOf('debug=t') != -1 ? 'teacher' : - window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin' + window.location.search.indexOf('debug=s') != -1 ? 'mfp2guqj3' : 'admin' window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index 749e4870c..b7d46eac6 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -28,6 +28,20 @@ class Addcourses extends Component{ } componentDidMount() { + axios.interceptors.response.use((response) => { + if (response != undefined) + if (response && response.data.status === 409) { + this.setState({ + Addcoursestypes: true + }) + + } + return response; + }, (error) => { + //TODO 这里如果样式变了会出现css不加载的情况 + + }); + let {Addcoursestype}=this.props; this.setState({ @@ -75,6 +89,7 @@ class Addcourses extends Component{ }) }else{ this.setState({ + professor:null, assistant_professor:null, Checkboxteacherchecked:e.target.checked, Checkboxteachingtype:false @@ -102,7 +117,7 @@ class Addcourses extends Component{ hidetojoinclass=()=>{ - this.props.hideAddcoursestype(); + let {Addcoursestype}=this.props; // console.log(this.props) this.setState({ invite_code:undefined, @@ -114,13 +129,19 @@ class Addcourses extends Component{ Checkboxteachingtype:false, professor:null, assistant_professor:null, - student:null + student:null, + Addcoursestypes:false }) + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } + } submitasyn=(course_id)=>{ - let{professor}=this.state; + let{professor,Addcoursestype}=this.state; + if(professor===1){ this.setState({ loadtype:true, @@ -129,13 +150,17 @@ class Addcourses extends Component{ modalSave:(course_id)=>this.submitasyns(course_id), Addcoursestype:false }) - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } }else{ // let{course_id}=this.state; this.setState({ Addcoursestype:false }) - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } window.location.href ="/courses/"+course_id+"/students"; } @@ -145,6 +170,7 @@ class Addcourses extends Component{ } submittojoinclass=()=>{ + let{Addcoursestype}=this.state; this.setState({ isSpin:true }) @@ -191,7 +217,9 @@ class Addcourses extends Component{ message:"提示", description:response.data.message }); - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } // this.props.showNotification(response.data.message); @@ -204,7 +232,9 @@ class Addcourses extends Component{ this.setState({ Addcoursestype:false }) - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } // this.setState({ @@ -285,7 +315,8 @@ class Addcourses extends Component{ loadtype, modalsType, modalsTopval, - modalSave + modalSave, + Addcoursestypes }=this.state; const antIcon = ; return( @@ -301,7 +332,7 @@ class Addcourses extends Component{ keyboard={false} className={"HomeworkModal"} title="加入课堂" - visible={Addcoursestype} + visible={Addcoursestype===undefined||Addcoursestype===false?Addcoursestypes:Addcoursestype} closable={false} footer={null} destroyOnClose={true} @@ -314,7 +345,7 @@ class Addcourses extends Component{ diff --git a/public/react/src/modules/courses/coursesPublic/PathModal.js b/public/react/src/modules/courses/coursesPublic/PathModal.js index 824c50c78..10a298c90 100644 --- a/public/react/src/modules/courses/coursesPublic/PathModal.js +++ b/public/react/src/modules/courses/coursesPublic/PathModal.js @@ -91,7 +91,7 @@ class PathModal extends Component{ this.setState({ type:types, page:1, - newshixunmodallist:undefined + newshixunmodallist:[] }) this.funshixunpathlist(Searchvalue,types,true,1) } @@ -103,10 +103,11 @@ class PathModal extends Component{ }) } SenttotheSearch=(value)=>{ + this.setState({ + page:1, + newshixunmodallist:[] + }) let{type}=this.state; - this.setState({ - page:1, - }) this.funshixunpathlist(value,type,true,1) } @@ -269,7 +270,7 @@ class PathModal extends Component{ `} -
@@ -298,7 +299,7 @@ class PathModal extends Component{ }) } -
+ } { this.state.patheditarrytype===true?{this.state.patheditarryvalue}:""}
取消 diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index eb1627e83..136e50d6e 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -290,11 +290,13 @@ class CoursesNew extends Component { search:value }).then((result)=>{ // console.log(result.data) - this.setState({ - searchlist:result.data.course_lists, - // course:value, - fetching:false - }) + if (result.data.message===undefined) { + this.setState({ + searchlist: result.data.course_lists, + // course:value, + fetching: false + }) + } // this.props.form.setFieldsValue({ // course:value // }) @@ -343,13 +345,15 @@ class CoursesNew extends Component { search: value } }).then((result)=>{ - this.setState({ - searchlistscholl:result.data.school_names, - scholl:value - }) - this.props.form.setFieldsValue({ - scholl:value - }) + if (result.data.message===undefined) { + this.setState({ + searchlistscholl: result.data.school_names, + scholl: value + }) + this.props.form.setFieldsValue({ + scholl: value + }) + } }).catch((error)=>{ console.log(error) }) diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index 3a4efc17d..78ee31e82 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -1137,7 +1137,7 @@ class ShixunHomework extends Component{ `} {/*onChange={this.onCheckBoxChange} value={checkBoxValues}*/} {datas===undefined?"": - { datas.homeworks.map((item, index) => { + { datas.homeworks && datas.homeworks.map((item, index) => { // console.log("ShixunhomeWorkItem") // console.log("++++++++++++++++++++++++++++++++++++++++++") // console.log(JSON.stringify(this.props)) diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js index d587dc337..54fe17b9f 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -392,11 +392,12 @@ class LoginDialog extends Component { } return ( - this.handleDialogClose()} > + {isRender===true?
{this.handleDialogClose()}}> @@ -489,7 +490,7 @@ class LoginDialog extends Component {
- + :""}
); diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js index 6e2ca0883..fc0a0fea9 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js @@ -59,7 +59,8 @@ class DetailCardsEditAndAdd extends Component{ AddShixunBox = () =>{ this.setState({ selectShixun:true, - patheditarry:[] + patheditarry:[], + page:1 }) this.changeTag(0,""); } @@ -68,6 +69,7 @@ class DetailCardsEditAndAdd extends Component{ cloasShixunBox =()=>{ this.setState({ selectShixun:false, + page:1, patheditarry:[] }) } @@ -103,7 +105,8 @@ class DetailCardsEditAndAdd extends Component{ shixuns_listedit:newshixuns_listedit, shixuns_listeditlist:list, patheditarry:[], - selectShixun:false + selectShixun:false, + page:1, }) }).catch((error) => { console.log(error) @@ -139,18 +142,23 @@ class DetailCardsEditAndAdd extends Component{ //打开选择实训弹框初始化tag标签和列表 changeTag=(id,search)=>{ - this.setState({ - hometypepvisible:true - }) - let pathId=this.props.pathid; - let {page}=this.state; - let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+page + + this.setState({ + ChooseShixunListshixun_list:[], + page:1, + hometypepvisible:true, + }) + + let pathId=this.props.pathid; + + let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+1 if(search!="" && search!=undefined){ url+="&search="+search; } if(id!=0){ url+="&type="+id; } + axios.get(url).then((result)=>{ if(result.status===200){ this.setState({ @@ -287,43 +295,45 @@ class DetailCardsEditAndAdd extends Component{ contentViewScrolladd=(e)=>{ - //滑动到底判断 if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ // console.log("到达底部"); - this.setState({ - hometypepvisible:true - }) - let pathId=this.props.pathid; - let {search,page,type,ChooseShixunListshixun_list}=this.state; - let newpage=page+1; - let newChooseShixunListshixun_list=ChooseShixunListshixun_list; - let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage - if(search!="" && search!=undefined){ - url+="&search="+search; - } - if(type!=0){ - url+="&type="+type; - } - axios.get(url).then((result)=>{ - if(result.status===200){ - let list =result.data.shixun_list; - - for(var i=0; i{ - console.log(error); - }) + debugger + this.setState({ + hometypepvisible:true + }) + let pathId=this.props.pathid; + let {search,page,type,ChooseShixunListshixun_list}=this.state; + let newpage=page+1; + let newChooseShixunListshixun_list=ChooseShixunListshixun_list; + let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage + if(search!="" && search!=undefined){ + url+="&search="+search; + } + if(type!=0){ + url+="&type="+type; + } + axios.get(url).then((result)=>{ + if(result.status===200){ + let list =result.data.shixun_list; + + for(var i=0; i{ + console.log(error); + }) + + } } @@ -481,7 +491,7 @@ class DetailCardsEditAndAdd extends Component{ ` } -
@@ -508,7 +518,7 @@ class DetailCardsEditAndAdd extends Component{ }) } -
+
}
取消 确定 diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index 6843f678a..bb410c1ce 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -139,7 +139,9 @@ class PathDetailIndex extends Component{ let pathid=this.props.match.params.pathId; let url="/paths/"+pathid+".json"; axios.get(url).then((result)=>{ - + if (result.data.status == 407) { + return; + } if(result.data.allow_visit===true){ this.setState({ detailInfoList:result.data, @@ -162,6 +164,9 @@ class PathDetailIndex extends Component{ let pathid=this.props.match.params.pathId; let url="/paths/"+pathid+".json"; axios.get(url).then((result)=>{ + if (result.data.status == 407) { + return; + } if(result.data.allow_visit===true){ this.setState({ detailInfoList:result.data, diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index c1ad97276..2455b0be4 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -534,12 +534,12 @@ submittojoinclass=(value)=>{
- {/**/} + {isRender===true?:""} -
+
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} 高校智能化教学与实训平台 @@ -737,14 +737,14 @@ submittojoinclass=(value)=>{
  • - + placeholder="请输入5位项目邀请码或6位分班邀请码" value={tojoinclasstitle} onInput={this.inputjoinclassvalue}/>
  • 请输入5位课堂邀请码或6位分班邀请码

    + style={{marginLeft: '90px',display:code_notice===true?'block':"none"}}>请输入5位项目邀请码或6位分班邀请码

  • diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 2beb9fa1b..e092c17d4 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -302,11 +302,12 @@ export function TPMIndexHOC(WrappedComponent) {
    + {/* 注释掉了1440 影响到了手机屏幕的展示 */}