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

dev_auth
cxt 5 years ago
commit b8bddf1e78

@ -124,7 +124,7 @@ class CompetitionsIndex extends Component{
size="large"
dataSource={datas&&datas}
renderItem={(item,key) => (
<a href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
<a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
>
@ -181,7 +181,7 @@ class CompetitionsIndex extends Component{
<List.Item.Meta
title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<a className={"competitionstitles"}
<a target="_blank" className={"competitionstitles"}
href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
>{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a>
{/*<span>{item.sub_title===null?"":*/}

@ -31,6 +31,9 @@ class CompetitionCommon extends Component{
window.document.title = '竞赛';
if(this.props.match.params.identifier!=null){
this.getbannerdata();
// this.setState({
// thiskeys:this.props.location.search.replace('?menu=', '')
// })
// let url=`/competitions/${this.props.match.params.identifier}.json`;
// axios.get(url).then((response) => {
// if(response.status===200){
@ -45,19 +48,34 @@ class CompetitionCommon extends Component{
}
getbannerdata=()=>{
let menuid=this.props.location.search.replace('?menu=', '');
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
axios.get(url).then((response) => {
if(response.status===200){
this.setState({
data:response.data,
thiskeys:response.data.competition_modules[0].id
data:response.data,
thiskeys:menuid===undefined||menuid===""?response.data.competition_modules[0].id:menuid
})
this.getrightdata(
response.data.competition_modules[0].id,
response.data.competition_modules[0].module_type,
response.data.competition_modules[0].module_url,
response.data.competition_modules[0].has_url
)
if(menuid===undefined||menuid===""){
this.getrightdata(
response.data.competition_modules[0].id,
response.data.competition_modules[0].module_type,
response.data.competition_modules[0].module_url,
response.data.competition_modules[0].has_url
)
}else{
let newlist=response.data.competition_modules;
newlist.map((item,key)=>{
if(`${item.id}`===`${menuid}`){
this.getrightdata(
item.id,
item.module_type,
item.module_url,
item.has_url
)
}
})
}
}
}).catch((error) => {
console.log(error)
@ -83,6 +101,7 @@ class CompetitionCommon extends Component{
getrightdatas=(e)=>{
let keys=parseInt(e.key);
this.getlistdata(keys)
this.props.history.replace(`?menu=${keys}`);
}
getlistdata=(keys,listkey)=>{
@ -109,7 +128,7 @@ class CompetitionCommon extends Component{
if(response.status===200){
this.setState({
chart_rules:response.data,
tabkey:tabkey===undefined?response.data.stages[0].id===null?"0":`${response.data.stages[0].id}`:tabkey
tabkey:tabkey===undefined?response.data.stages[0].id===null?"0":`${response.data.stages[0].id}`:tabkey
})
@ -121,6 +140,7 @@ class CompetitionCommon extends Component{
}
getrightdata=(id,typeid,module_url,has_url,listkey)=>{
// if(typeid==="enroll"){
// this.props.history.replace(`/competitions/${this.props.match.params.identifier}/enroll`);
// return
@ -234,8 +254,8 @@ class CompetitionCommon extends Component{
}
render() {
let {data,has_url,module_type,Competitionedittype,mdContentdata}=this.state;
let {data,thiskeys,Competitionedittype}=this.state;
console.log(thiskeys)
return (
data===undefined?"":<div className={"educontent clearfix mt20 "}>

@ -30,6 +30,7 @@ class CompetitionContents extends Component{
}).catch((error) => {
console.log(error)
})
this.props.MdifHasAnchorJustScorll();
}
derivefun=(url)=>{
@ -65,6 +66,7 @@ class CompetitionContents extends Component{
});
}
render() {
this.props.MdifHasAnchorJustScorll();
const operations = <div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost>

@ -67,7 +67,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
let anchorElement = document.getElementsByName(anchor);
if (anchorElement) {
if (anchorElement.length!=0) {
anchorElement[0].scrollIntoView();
anchorElement[anchorElement.length-1].scrollIntoView();
}
}
}

@ -617,8 +617,8 @@ export function TPMIndexHOC(WrappedComponent) {
if (!!anchor) {
let anchorElement = document.getElementsByName(anchor);
if (anchorElement) {
if (anchorElement.length!=0) {
anchorElement[1].scrollIntoView();
if (anchorElement.length>0){
anchorElement[anchorElement.length-1].scrollIntoView();
}
}
}

Loading…
Cancel
Save