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

chromesetting
daiao 6 years ago
commit 8308fcc6d2

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

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

@ -32,7 +32,7 @@
<%= link_to shixun.try(:identifier), shixun_path(shixun.try(:identifier)), target: '_blank'%> <%= link_to shixun.try(:identifier), shixun_path(shixun.try(:identifier)), target: '_blank'%>
<% end%> <% end%>
</td> </td>
<td><%= overflow_hidden_span(shixun&.fork_reason) %></td> <td><%= overflow_hidden_span(shixun&.fork_reason, width: 150) %></td>
<td><%= shixun.challenges.where(:st => 0).size %></td> <td><%= shixun.challenges.where(:st => 0).size %></td>
<td><%= shixun.challenges.where(:st => 1).size %></td> <td><%= shixun.challenges.where(:st => 1).size %></td>
<td class="shixuns-status-<%= shixun.status %>"><%= shixun_authentication_status shixun %></td> <td class="shixuns-status-<%= shixun.status %>"><%= shixun_authentication_status shixun %></td>

@ -353,9 +353,15 @@ class NewHeader extends Component {
// this.setState({ // this.setState({
// isRender:true // 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`; var url = `/accounts/logout.json`;
// let storage=window.localStorage;
axios.get((url)).then((result) => { axios.get((url)).then((result) => {
// storage.removeItem(newTPMsettings);
// storage.removeItem(shixunopenprocess);
// storage.removeItem( openopenpublictype);
if(result!==undefined){ if(result!==undefined){
// this.setState({ // this.setState({
// isRender:true // isRender:true

@ -99,7 +99,8 @@ class TPMBanner extends Component {
this.setState({ this.setState({
openknow:false openknow:false
}) })
storage.setItem("shixunopenprocess",true); let shixunopenprocess=this.props.user&&this.props.user.user_id+'shixunopenprocess';
storage.setItem(shixunopenprocess,true);
} }
openshowpublic=()=>{ openshowpublic=()=>{
@ -107,7 +108,8 @@ class TPMBanner extends Component {
this.setState({ this.setState({
openshowpublictype:false 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 getshixunopenprocess=this.props.user&&this.props.user.user_id+'shixunopenprocess';
let shixunopenprocess=window.localStorage.shixunopenprocess; let getopenopenpublictype=this.props.user&&this.props.user.user_id+'openopenpublictype';
let openopenpublictype=window.localStorage.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.status===0&&this.props.openknows===false){
if(this.props.shixunsDetails&&this.props.shixunsDetails.shixun_status === 0 && this.props.identity < 5){ 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({ this.setState({
openknow:true 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.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(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({ this.setState({
openshowpublictype:true openshowpublictype:true
}) })

@ -157,11 +157,35 @@ class TPMIndex extends Component {
this.setState({ this.setState({
openknows:false 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 = () => { 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; let id = this.props.match.params.shixunId;
// console.log('props', this.props); // console.log('props', this.props);
// let collaborators = `/shixuns/` + id + `/propaedeutics.json`; // let collaborators = `/shixuns/` + id + `/propaedeutics.json`;
@ -214,7 +238,7 @@ class TPMIndex extends Component {
if(response.data.identity <4){ if(response.data.identity <4){
if(newTPMsettings===undefined||newTPMsettings===false){ if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){
this.setState({ this.setState({
openknows:true openknows:true
}) })

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

Loading…
Cancel
Save