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

dev_forum
hjm 5 years ago
commit 01ac19fd21

@ -34,10 +34,11 @@ class ApplicationController < ActionController::Base
User.current.admin? || User.current.business?
end
# 访问课堂时没权限直接弹加入课堂的弹框 409
def user_course_identity
@user_course_identity = current_user.course_identity(@course)
if @user_course_identity > Course::STUDENT && @course.is_public == 0
tip_exception(403, "您没有权限进入")
tip_exception(409, "您没有权限进入")
end
uid_logger("###############user_course_identity:#{@user_course_identity}")
end
@ -186,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)

@ -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 (
<LocaleProvider locale={zhCN}>
@ -270,6 +272,7 @@ class App extends Component {
<Notcompletedysl {...this.props} {...this.state}></Notcompletedysl>
<Trialapplicationysl {...this.props} {...this.state}></Trialapplicationysl>
<Trialapplicationreview {...this.props} {...this.state}></Trialapplicationreview>
<Addcourses {...this.props} {...this.state}/>
{/*{*/}
{/* isRender === true?*/}
{/* <LoginDialog></LoginDialog> : ""*/}

@ -18,9 +18,10 @@ function locationurl(list){
}
// TODO 开发期多个身份切换
const debugType =window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin'
window._debugType = debugType;
const debugType =""
// window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin'
// window._debugType = debugType;
export function initAxiosInterceptors(props) {
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation

@ -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({
@ -102,7 +116,7 @@ class Addcourses extends Component{
hidetojoinclass=()=>{
this.props.hideAddcoursestype();
// console.log(this.props)
this.setState({
invite_code:undefined,
@ -114,9 +128,10 @@ class Addcourses extends Component{
Checkboxteachingtype:false,
professor:null,
assistant_professor:null,
student:null
student:null,
Addcoursestypes:false
})
this.props.hideAddcoursestype();
}
submitasyn=(course_id)=>{
@ -285,7 +300,8 @@ class Addcourses extends Component{
loadtype,
modalsType,
modalsTopval,
modalSave
modalSave,
Addcoursestypes
}=this.state;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return(
@ -301,7 +317,7 @@ class Addcourses extends Component{
keyboard={false}
className={"HomeworkModal"}
title="加入课堂"
visible={Addcoursestype}
visible={Addcoursestype===undefined?Addcoursestypes:Addcoursestype}
closable={false}
footer={null}
destroyOnClose={true}
@ -314,7 +330,7 @@ class Addcourses extends Component{
<label className="panel-form-label fl">课堂邀请码</label>
<Input type="text" className="input-60-40 fl mt5" name="invite_code"
placeholder="请输入5位课堂邀请码或6位分班邀请码"
style={{ height: '30px'}}
style={{width:'275px'}}
value={invite_code} onInput={this.inputjoinclassvalue}/>
</li>

@ -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{
`}
</style>
<div className="over210 pl20 pr20"
{ newshixunmodallist&&newshixunmodallist.length===0?"":<div className="over210 pl20 pr20"
onScroll={this.contentViewScrolledit}
style={{"Height":"204px"}}>
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
@ -298,7 +299,7 @@ class PathModal extends Component{
})
}
</Checkbox.Group>
</div>
</div>}
{ this.state.patheditarrytype===true?<span className={"color-red"}>{this.state.patheditarryvalue}</span>:""}
<div className="mt20 marginauto clearfix edu-txt-center">
<a className="pop_close task-btn mr30 margin-tp26" onClick={this.hidecouseShixunModal}>取消</a>

@ -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)
})

@ -392,11 +392,12 @@ class LoginDialog extends Component {
}
return (
<Dialog open={true} id="DialogID"
<Dialog open={true} id="DialogID"
style={{ display: isRender==false? 'none' : ''}}
disableEscapeKeyDown={true}
onClose={() => this.handleDialogClose()}
>
{isRender===true?
<div className={dialogBox}>
<div id="closeIcon" onClick={()=>{this.handleDialogClose()}}>
<i className="iconfont icon-shanchudiao"></i>
@ -489,7 +490,7 @@ class LoginDialog extends Component {
</div>
</div>
:""}
</Dialog>
);

@ -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<list.length; i++){
newChooseShixunListshixun_list.push(list[i])
}
this.setState({
ChooseShixunList:result.data,
hometypepvisible:false,
type:type,
search:search,
page:newpage,
ChooseShixunListshixun_list:newChooseShixunListshixun_list
})
}
}).catch((error)=>{
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<list.length; i++){
newChooseShixunListshixun_list.push(list[i])
}
this.setState({
ChooseShixunList:result.data,
hometypepvisible:false,
type:type,
search:search,
page:newpage,
ChooseShixunListshixun_list:newChooseShixunListshixun_list
})
}
}).catch((error)=>{
console.log(error);
})
}
}
@ -481,7 +491,7 @@ class DetailCardsEditAndAdd extends Component{
`
}
</style>
<div className="over180 pl20 pr20"
{ChooseShixunListshixun_list && ChooseShixunListshixun_list.length===0?"": <div className="over180 pl20 pr20"
onScroll={this.contentViewScrolladd}
>
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
@ -508,7 +518,7 @@ class DetailCardsEditAndAdd extends Component{
})
}
</Checkbox.Group>
</div>
</div>}
<div className="mt20 marginauto clearfix edu-txt-center">
<a className="pop_close task-btn mr30 margin-tp26" onClick={this.cloasShixunBox}>取消</a>
<a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>

@ -534,12 +534,12 @@ submittojoinclass=(value)=>{
<div className="newHeader" id="nHeader" >
{/*<LoginDialog*/}
{/*{...this.state}*/}
{/*{...this.props}*/}
{/*/>*/}
{isRender===true?<LoginDialog
{...this.state}
{...this.props}
/>:""}
<div className="educontent clearfix">
<div className="educontent clearfix">
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/}
<a href="/">
<img alt="高校智能化教学与实训平台" className="logoimg" src={getImageUrl("images/educoder/headNavLogo.png?1526520218")}></img>
@ -737,13 +737,14 @@ submittojoinclass=(value)=>{
<ul>
<li className="clearfix mb10">
<label className="panel-form-label fl">项目邀请码</label>
<Input type="text" className="input-60-40 fl" name="invite_code"
placeholder="请输入5位课堂邀请码或6位分班邀请码" value={tojoinclasstitle} onInput={this.inputjoinclassvalue}/>
<Input type="text" className="input-60-40 fl mt5" name="invite_code"
style={{width: '275px'}}
placeholder="请输入5位项目邀请码或6位分班邀请码" value={tojoinclasstitle} onInput={this.inputjoinclassvalue}/>
</li>
<p id="none_invite_code_notice"
className="color-orange none f12"
style={{marginLeft: '90px',display:code_notice===true?'block':"none"}}>请输入5位课堂邀请码或6位分班邀请码</p>
style={{marginLeft: '90px',display:code_notice===true?'block':"none"}}>请输入5位项目邀请码或6位分班邀请码</p>
<li className="clearfix ">

@ -597,7 +597,7 @@ class TPMBanner extends Component {
</ul>
<div className="pr fl" id="commentsStar">
<div className={"color-grey-c"} style={{color: "#Fff",textAlign: "center"}}>学员评分</div>
<div className={"color-grey-c mb11"} style={{color: "#Fff",textAlign: "center"}}>学员评分</div>
<div className="rateYo">
<Rating value={star_info[0]} disabled allowHalf/>
</div>

@ -392,10 +392,12 @@ export default class TPMsettings extends Component {
let departmentsUrl = `/shixuns/departments.json`;
axios.get(departmentsUrl).then((response) => {
if (response.status === 200) {
this.setState({
departmentslist: response.data.shools_name
});
}
if (response.data.message === undefined) {
this.setState({
departmentslist: response.data.shools_name
});
}
}
}).catch((error) => {
console.log(error)
});

@ -236,9 +236,7 @@ class Newshixuns extends Component {
let newshixunUrl = `/shixuns/new.json`;
axios.get(newshixunUrl).then((response) => {
if (response.status === 200) {
if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
} else {
if (response.data.message===undefined) {
this.setState({
newshixunlist: response.data
});
@ -253,9 +251,11 @@ class Newshixuns extends Component {
let departmentsUrl = `/shixuns/departments.json`;
axios.get(departmentsUrl).then((response) => {
if (response.status === 200) {
this.setState({
departmentslist: response.data.shools_name
});
if (response.data.message===undefined) {
this.setState({
departmentslist: response.data.shools_name
});
}
}
}).catch((error) => {
console.log(error)
@ -498,7 +498,9 @@ class Newshixuns extends Component {
function fake() {
let departmentsUrl = `/shixuns/departments.json?q=` + currentValue;
axios.get(departmentsUrl).then((response) => {
callback(response.data.shools_name);
if (response.data.message===undefined) {
callback(response.data.shools_name);
}
}).catch((error) => {
console.log(error)
});

@ -87,7 +87,7 @@ a:active{text-decoration:none;}
#commentsStar{
margin-top: -7px;
width: 90px;
margin-bottom: 11px;
}
.startbtnModal .ant-modal-content{
background: transparent;

@ -273,7 +273,7 @@ class InterestpageMax extends Component {
{gouxuans4&&gouxuans4.map((item,key)=>{
return(
<div className={item.id<5?"ysldivhomediv12":"ysldivhomediv22"} onClick={()=>this.Clickteacher2(item.id)}>
{item.bool===true?<img src={gouxuan} className="yslgouxuanimg2"/>:<div className="yslgouxuanimg22"></div>}
{item.bool===true?<img src={gouxuan} className="yslgouxuanimg22x"/>:<div className="yslgouxuanimg22x"></div>}
<img className="div1img2" src={item.url}/>
<span className="textall2">{item.name}</span>
</div>

@ -168,14 +168,21 @@
margin-left: 26px;
}
.yslgouxuanimg22{
.div1img2xx{
width: 20px;
margin-left: 26px;
}
.yslgouxuanimg22x{
width: 20px;
height: 20px;
margin-left: 75px;
}
.yslgouxuanimg2{
.yslgouxuanimg2x{
height: 20px;
width: 20px;
margin-left: 75px;
}
.yslbutondls{

Loading…
Cancel
Save