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

dev_aliyun_beta
杨树林 5 years ago
commit 77d18e78d0

@ -53,11 +53,15 @@ class ExerciseDisplay extends Component{
componentDidMount = () => { componentDidMount = () => {
const Id = this.props.match.params.Id const Id = this.props.match.params.Id
if (Id) { if (Id) {
const url = `/exercises/${Id}.json` const url = `/${this.props.urlPath || 'exercises'}/${Id}.json`
axios.get(url) axios.get(url)
.then((response) => { .then((response) => {
if (response.data.status == 0) { if (response.data.exercise) {
response.data.exercise.exercise_description = response.data.exercise.exercise_description || response.data.exercise.description
response.data.exercise.exercise_name = response.data.exercise.exercise_name || response.data.exercise.name
response.data.exercise.exercise_status = response.data.exercise.exercise_status == undefined ? 1 : response.data.exercise.exercise_status
this.setState({...response.data}) this.setState({...response.data})
this.props.detailFetchCallback && this.props.detailFetchCallback(response);
} }
}) })
.catch(function (error) { .catch(function (error) {

@ -486,18 +486,20 @@ class InfosTopics extends Component{
{item.is_public===true?<span className="edu-filter-btn ml15 fl typestyle mt3 topiscfilterbtn">公开</span>:""} {item.is_public===true?<span className="edu-filter-btn ml15 fl typestyle mt3 topiscfilterbtn">公开</span>:""}
{types==="personal"&&item.is_public===false?user_id===targetuserid&&user_type!="学生"?<a className="btn colorblue mr25 fr font-16" onClick={()=>this.openTopics(item.id)}>设为公开</a>:"":""}
<div className="cl"></div> <div className="cl"></div>
<p className="color-grey panel-lightgrey mt16 fl"> <p className="color-grey panel-lightgrey mt16 fl">
<span className={types==="personal"?"topicswidth300":"topicswidth400"}> <span className={"topicswidth600"}>
{types==="publicly"?<span className="topsics100 color-grey9">{item.creator_name}</span>:""} {types==="publicly"?<span className="topsics135 color-grey9 mr50">{item.creator_name}</span>:""}
<span className="mr50 color-grey9">{item.quotes_count} 次引用</span> <span className="mr50 color-grey9">{item.quotes_count} 次引用</span>
<span className="mr50 color-grey9">{item.solve_count} 次答题</span> <span className="mr50 color-grey9">{item.solve_count} 次答题</span>
<span className="mr50 color-grey9">{moment(item.updated_at).fromNow()}</span> <span className="mr50 color-grey9">{moment(item.updated_at).fromNow()}</span>
</span> </span>
{item.course_list_name===null?"":<span className="topicsbtn">{item.course_list_name}</span>} {item.course_list_name===null?"":<span className={"topsicrelative topsicinline"} title={item.course_list_name}>
<div className={types==="personal"?"topicsbtn topsicsmax550":"topsicsmax550 topicsbtn"}>{item.course_list_name}</div>
</span>}
</p> </p>
<div className="homepagePostSetting homepagePostSettingname topscisright"> <div className="homepagePostSetting homepagePostSettingname topscisright">
@ -512,6 +514,8 @@ class InfosTopics extends Component{
} }
>编辑</a> >编辑</a>
:"":""} :"":""}
{types==="personal"&&item.is_public===false?user_id===targetuserid&&user_type!="学生"?<a className="btn colorblue mr25 fr font-16" onClick={()=>this.openTopics(item.id)}>设为公开</a>:"":""}
</div> </div>
</div> </div>
</div> </div>

@ -149,6 +149,13 @@ class BanksIndex extends Component{
/>) />)
} }
}></Route> }></Route>
<Route path='/banks/exercise/:Id'
render={
(props) => {
return (<BanksTabIndex {...this.props} {...props} {...this.state} {...common}
/>)
}
}></Route>
<Route path='/banks/gtopic/:bankId/edit' <Route path='/banks/gtopic/:bankId/edit'
render={ render={

@ -17,6 +17,11 @@ const PollBanks = Loadable({
loader: () => import('./PollBanksContent'), loader: () => import('./PollBanksContent'),
loading: Loading, loading: Loading,
}) })
// 试卷详情
const ExerciseBanksDetail = Loadable({
loader: () => import('./ExerciseBanksDetail'),
loading: Loading,
});
class BanksTabIndex extends Component{ class BanksTabIndex extends Component{
constructor(props){ constructor(props){
@ -53,7 +58,13 @@ class BanksTabIndex extends Component{
></BanksMenu> ></BanksMenu>
} }
<Switch {...this.props}> <Switch {...this.props}>
<Route path='/banks/exercise/:Id'
render={
(props) => {
return (<ExerciseBanksDetail {...this.props} {...props} {...this.state} {...common}
/>)
}
}></Route>
<Route path='/banks/gtopic/:bankId' <Route path='/banks/gtopic/:bankId'
render={ render={

@ -0,0 +1,54 @@
import React, { Component } from 'react';
import axios from 'axios'
import ExerciseDisplay from '../../../courses/exercise/ExerciseDisplay'
class ExerciseBanksDetail extends Component{
constructor(props){
super(props);
this.state={
}
}
componentDidMount = () =>{
}
detailFetchCallback = (result) => {
let Id=this.props.match.params.Id;
const crumbData={
title: result.data.exercise && result.data.exercise.name,
is_public: result.data.exercise && result.data.exercise.is_public,
crumbArray:[
{content:'详情'},
]
}
const menuData={
tab:'0',//tab选中的index
menuArray:[//tab以及tab路由
{to:`/banks/exercise/${Id}`,content:'内容详情'}
],
category:'exercise',//
tos: `/banks/exercise/${Id}/edit`,
id: Id,
}
this.props.initPublic(crumbData,menuData);
}
render(){
let { pollDetail } = this.state
return(
<div>
<ExerciseDisplay {...this.props} {...this.state}
urlPath = {'exercise_banks'}
detailFetchCallback={this.detailFetchCallback}
>
</ExerciseDisplay>
</div>
)
}
}
export default ExerciseBanksDetail

@ -126,7 +126,7 @@ class BanksMenu extends Component{
<span className="fr mt18"> <span className="fr mt18">
<WordsBtn onClick={()=>this.deletecheckBoxValues(banksMenu&&banksMenu.id,banksMenu&&banksMenu.category)}style="blue" className="ml20 font-16">删除</WordsBtn> <WordsBtn onClick={()=>this.deletecheckBoxValues(banksMenu&&banksMenu.id,banksMenu&&banksMenu.category)}style="blue" className="ml20 font-16">删除</WordsBtn>
<WordsBtn to={banksMenu&&banksMenu.category==='poll'?banksMenu.tos:""} style="blue" className="ml20 font-16">编辑</WordsBtn> <WordsBtn to={ banksMenu.tos ? banksMenu.tos:""} style="blue" className="ml20 font-16">编辑</WordsBtn>
<WordsBtn onClick={()=>this.sendTopics()} style="blue" className="ml20 font-16">发送</WordsBtn> <WordsBtn onClick={()=>this.sendTopics()} style="blue" className="ml20 font-16">发送</WordsBtn>
</span> </span>
</div> </div>

@ -348,8 +348,8 @@
opacity: 1; opacity: 1;
border-radius: 2px; border-radius: 2px;
} }
.topicswidth400{ .topicswidth600{
width: 400px; mac-width: 600px;
display: inline-block; display: inline-block;
} }
.topicswidth300{ .topicswidth300{
@ -366,13 +366,13 @@
.topscisright{ .topscisright{
right: 0px; right: 0px;
top: 50px; top: 64px;
display: block; display: block;
position: absolute; position: absolute;
} }
.topsics100{ .topsics135{
width: 100px; max-width: 135px;
display: inline-block; display: inline-block;
} }
@ -406,3 +406,20 @@
.mb45{ .mb45{
margin-bottom: 45px!important; margin-bottom: 45px!important;
} }
.topsicsmax550{
max-width: 550px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
position: absolute;
top: -16px;
}
.topsicrelative{
position: relative;
}
.topsicinline{
display: inline-block;
}
Loading…
Cancel
Save