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 = () => {
const Id = this.props.match.params.Id
if (Id) {
const url = `/exercises/${Id}.json`
const url = `/${this.props.urlPath || 'exercises'}/${Id}.json`
axios.get(url)
.then((response) => {
if (response.data.status == 0) {
this.setState({...response.data})
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.props.detailFetchCallback && this.props.detailFetchCallback(response);
}
})
.catch(function (error) {

@ -486,32 +486,36 @@ class InfosTopics extends Component{
{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>
<p className="color-grey panel-lightgrey mt16 fl">
<span className={types==="personal"?"topicswidth300":"topicswidth400"}>
{types==="publicly"?<span className="topsics100 color-grey9">{item.creator_name}</span>:""}
<span className={"topicswidth600"}>
{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.solve_count} 次答题</span>
<span className="mr50 color-grey9">{moment(item.updated_at).fromNow()}</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>
<div className="homepagePostSetting homepagePostSettingname topscisright">
{types==="personal"?user_id===targetuserid&&user_type!="学生"?
<a className="btn colorblue mr25 font-16 fr"
href={category==="normal"?`/banks/normal/${item.id}/edit`:
category==="group"?`/banks/group/${item.id}/edit`:
href={category==="normal"?`/banks/normal/${item.id}/edit`:
category==="group"?`/banks/group/${item.id}/edit`:
category==="poll"?`/banks/poll/${item.id}/edit`:
category==="exercise"?`/banks/exercise/${item.id}/edit`:
category==="gtask"?`/banks/gtask/${item.id}/edit`:
category==="gtopic"?`/banks/gtopic/${item.id}/edit`:""
}
category==="exercise"?`/banks/exercise/${item.id}/edit`:
category==="gtask"?`/banks/gtask/${item.id}/edit`:
category==="gtopic"?`/banks/gtopic/${item.id}/edit`:""
}
>编辑</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>

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

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

@ -348,8 +348,8 @@
opacity: 1;
border-radius: 2px;
}
.topicswidth400{
width: 400px;
.topicswidth600{
mac-width: 600px;
display: inline-block;
}
.topicswidth300{
@ -366,13 +366,13 @@
.topscisright{
right: 0px;
top: 50px;
top: 64px;
display: block;
position: absolute;
}
.topsics100{
width: 100px;
.topsics135{
max-width: 135px;
display: inline-block;
}
@ -405,4 +405,21 @@
.mb45{
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