Merge branches 'dev_aliyun' and 'dev_item_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_item_bank

yslnewtiku
杨树林 5 years ago
commit 6753f5fee4

@ -5,6 +5,6 @@ class ShixunListsController < ApplicationController
private
def search_params
params.permit(:keyword, :type, :page, :limit, :order, :status, :diff)
params.permit(:keyword, :type, :page, :limit, :order, :status, :diff, :sort)
end
end

@ -16,7 +16,9 @@ module Searchable::Shixun
name: name,
description: Util.extract_content(description)[0..Searchable::MAXIMUM_LENGTH],
status: status,
myshixuns_count: myshixuns_count
myshixuns_count: myshixuns_count,
created_at: created_at,
publish_time: publish_time
}.merge!(searchable_user_data)
.merge!(searchable_challenge_data)
end

@ -37,9 +37,9 @@ document.addEventListener('keydown', (e) => {
if(e.data==="stopParent"){
//重置停止
timebool=false;
console.log("父窗口调用停止");
// console.log("父窗口调用停止");
}else if(e.data==="clonsParent"){
console.log("父窗口调用启动");
// console.log("父窗口调用启动");
//取消启动
timebool=true;
// runEvery10Sec();

@ -353,9 +353,15 @@ class NewHeader extends Component {
// this.setState({
// isRender:true
// })
// let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'
// let shixunopenprocess=this.props.user&&this.props.user.user_id+'shixunopenprocess'
// let openopenpublictype=this.props.user&&this.props.user.user_id+'openopenpublictype'
var url = `/accounts/logout.json`;
// let storage=window.localStorage;
axios.get((url)).then((result) => {
// storage.removeItem(newTPMsettings);
// storage.removeItem(shixunopenprocess);
// storage.removeItem( openopenpublictype);
if(result!==undefined){
// this.setState({
// isRender:true

@ -99,7 +99,8 @@ class TPMBanner extends Component {
this.setState({
openknow:false
})
storage.setItem("shixunopenprocess",true);
let shixunopenprocess=this.props.user&&this.props.user.user_id+'shixunopenprocess';
storage.setItem(shixunopenprocess,true);
}
openshowpublic=()=>{
@ -107,7 +108,8 @@ class TPMBanner extends Component {
this.setState({
openshowpublictype:false
})
storage.setItem("openopenpublictype",true);
let openopenpublictype=this.props.user&&this.props.user.user_id+'openopenpublictype';
storage.setItem(openopenpublictype,true);
}
@ -121,13 +123,14 @@ class TPMBanner extends Component {
})
}
}
let shixunopenprocess=window.localStorage.shixunopenprocess;
let openopenpublictype=window.localStorage.openopenpublictype;
let getshixunopenprocess=this.props.user&&this.props.user.user_id+'shixunopenprocess';
let getopenopenpublictype=this.props.user&&this.props.user.user_id+'openopenpublictype';
let shixunopenprocess=window.localStorage.getItem(getshixunopenprocess)
let openopenpublictype=window.localStorage.getItem(getopenopenpublictype)
if(this.props.status===0&&this.props.openknows===false){
if(this.props.shixunsDetails&&this.props.shixunsDetails.shixun_status === 0 && this.props.identity < 5){
if(shixunopenprocess===undefined||shixunopenprocess===false){
if(shixunopenprocess===undefined||shixunopenprocess===false||shixunopenprocess===null){
this.setState({
openknow:true
})
@ -147,7 +150,7 @@ class TPMBanner extends Component {
if(this.props.public===0&&this.props.status>1&&this.props.openknows===false){
if(this.props.shixunsDetails&&this.props.shixunsDetails.shixun_status === 2 && this.props.shixunsDetails&&this.props.shixunsDetails.public===0 && this.props.identity < 5){
if(openopenpublictype===undefined||openopenpublictype===false){
if(openopenpublictype===undefined||openopenpublictype===false||openopenpublictype===null){
this.setState({
openshowpublictype:true
})

@ -157,11 +157,35 @@ class TPMIndex extends Component {
this.setState({
openknows:false
})
storage.setItem("newTPMsettings",true);
let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings'
storage.setItem(newTPMsettings,true);
}
componentDidUpdate(prevProps, prevState) {
if (prevProps != this.props) {
if (prevProps.user != this.props.user) {
let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings';
let newTPMsettings=window.localStorage.getItem(getnewTPMsettings)
if(this.state.identity <4){
if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){
this.setState({
openknows:true
})
}else{
this.setState({
openknows:false
})
}
}
}
}
}
componentDidMount = () => {
let newTPMsettings=window.localStorage.newTPMsettings;
let getnewTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings';
let newTPMsettings=window.localStorage.getItem(getnewTPMsettings)
let id = this.props.match.params.shixunId;
// console.log('props', this.props);
// let collaborators = `/shixuns/` + id + `/propaedeutics.json`;
@ -214,7 +238,7 @@ class TPMIndex extends Component {
if(response.data.identity <4){
if(newTPMsettings===undefined||newTPMsettings===false){
if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){
this.setState({
openknows:true
})

@ -81,7 +81,7 @@ export default class Shixuninformation extends Component {
timetype=true;
}
this.setState({
use_scope_type:this.props&&this.props.status>1&&this.state.use_scope===0&&this.props&&this.props.identity>2||this.props&&this.props.public===2&&this.state.use_scope===0&&this.props&&this.props.identity>2?true:false,
use_scope_type:this.props&&this.props.status>1&& this.props.data && this.props.data.shixun.use_scope===0&&this.props&&this.props.identity>2||this.props&&this.props.public===2&& this.props.data && this.props.data.shixun.use_scope===0&&this.props&&this.props.identity>2?true:false,
can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy,
use_scope: this.props.data && this.props.data.shixun.use_scope,
opening_time: this.props.data && this.props.data.shixun.opening_time,
@ -117,7 +117,7 @@ export default class Shixuninformation extends Component {
timetype=true;
}
this.setState({
use_scope_type:this.props&&this.props.status>1&&this.state.use_scope===0&&this.props&&this.props.identity>2||this.props&&this.props.public===2&&this.state.use_scope===0&&this.props&&this.props.identity>2?true:false,
use_scope_type:this.props&&this.props.status>1&& this.props.data && this.props.data.shixun.use_scope===0&&this.props&&this.props.identity>2||this.props&&this.props.public===2&& this.props.data && this.props.data.shixun.use_scope===0&&this.props&&this.props.identity>2?true:false,
can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy,
use_scope: this.props.data && this.props.data.shixun.use_scope,
opening_time: this.props.data && this.props.data.shixun.opening_time,

@ -91,7 +91,7 @@ function JupyterTPI (props) {
// 保存代码
const addEventListeners = () => {
window.addEventListener('message', (e) => {
console.log("触发了jupytermessage");
// console.log("触发了jupytermessage");
if(e){
if(e.data){
if(e.data==="jupytermessage"){

@ -28,6 +28,7 @@ class Challengesjupyter extends Component {
enlarge:false,
fileList:[],
shuaxin:false,
showtime:false
}
}
@ -149,12 +150,15 @@ class Challengesjupyter extends Component {
window.addEventListener('message', (e) => {
console.log(e);
if(e){
if(e.data){
if(e.data==="jupytermessage"){
that.modifyjupyter();
if(this.state.showtime===false){
that.modifyjupyter();
this.setState({
showtime:true
})
}
}
}
@ -214,7 +218,7 @@ class Challengesjupyter extends Component {
modifyjupyter=()=>{
this.props.showNotification('实训正在保存中...!');
// this.props.showNotification('实训正在保存中...!');
let id=this.props.match.params.shixunId;
var jupyter_port="";
@ -234,11 +238,23 @@ class Challengesjupyter extends Component {
if (result.data.status === 0) {
// this.props.showNotification(`应用成功`);
console.log("应用成功了");
this.props.showNotification('实训保存成功!');
this.props.showNotification('保存成功!');
setTimeout(() => {
this.setState({
showtime:false
})
}, 500)
}else{
this.setState({
showtime:false
})
this.props.showNotification(result.data.message);
}
}).catch((error) => {
this.setState({
showtime:false
})
this.props.showNotification('实训保存失败!');
})

@ -528,7 +528,7 @@ class Collaborators extends Component {
{Collaboratorslist&&Collaboratorslist.length===0?<span>
请先将新的管理员通过 <a className={"color-blue"} onClick={() => this.showCollaboratorsvisible("cooperation")}>"添加合作者"</a>
</span>:""}
<RadioGroup onChange={this.onChange} value={this.state.value}>
<RadioGroup onChange={this.onChange}>
{
Collaboratorslist.length === 0 ? "" : Collaboratorslist.map((item, key) => {
return (

Loading…
Cancel
Save