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

dev_new_shixunsrepository
杨树林 5 years ago
commit b5decc25d1

@ -1,3 +1,3 @@
class ItemAnalysis < ApplicationRecord class ItemAnalysis < ApplicationRecord
belongs_to :item_bank belongs_to :item_bank, touch: true
end end

@ -1,3 +1,3 @@
class ItemChoice < ApplicationRecord class ItemChoice < ApplicationRecord
belongs_to :item_bank belongs_to :item_bank, touch: true
end end

@ -1,5 +1,5 @@
class TagDisciplineContainer < ApplicationRecord class TagDisciplineContainer < ApplicationRecord
belongs_to :tag_discipline belongs_to :tag_discipline
belongs_to :container, polymorphic: true, optional: true belongs_to :container, polymorphic: true, optional: true, touch: true
end end

@ -72,7 +72,6 @@ class Question extends Component {
} }
chakanjiexibool=(index)=>{ chakanjiexibool=(index)=>{
debugger
if(this.state.chakanjiexiboolindex===index){ if(this.state.chakanjiexiboolindex===index){
this.setState({ this.setState({
chakanjiexiboolindex:"无", chakanjiexiboolindex:"无",
@ -163,37 +162,8 @@ class Question extends Component {
//初始化 //初始化
componentDidMount() { componentDidMount() {
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
let {defaultActiveKey} = this.state;
var defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
var data = {
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: defaultActiveKeys,
page:1,
per_page:10,
};
this.getdata(data);
this.setState({
defaultActiveKey:defaultActiveKeys
})
let url = `/users/get_navigation_info.json`; let url = `/users/get_navigation_info.json`;
axios.get(url, {}).then((response) => { axios.get(url, {}).then((response) => {
// ////console.log("开始请求/get_navigation_info.json");
// ////console.log(response);
if (response != undefined) { if (response != undefined) {
if (response.status === 200) { if (response.status === 200) {
this.setState({ this.setState({
@ -203,9 +173,7 @@ class Question extends Component {
} }
} }
}); });
this.getbasket_listdata(); this.getbasket_listdata();
//获取题库筛选资料 //获取题库筛选资料
let urls = `/disciplines.json`; let urls = `/disciplines.json`;
axios.get(urls, {params: { axios.get(urls, {params: {

@ -36,7 +36,22 @@ class Contentpart extends Component {
chakanjiexibool=(index)=>{ chakanjiexibool=(index)=>{
this.props.chakanjiexibool(index); this.props.chakanjiexibool(index);
} }
componentDidUpdate(prevProps) {
if(prevProps.current_user !== this.props.current_user) {
debugger
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
let {defaultActiveKey} = this.props;
var defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
this.props.callback(defaultActiveKeys);
}
}
xinzenw=(e)=>{ xinzenw=(e)=>{
var urls="?"; var urls="?";
if(this.props.discipline_id){ if(this.props.discipline_id){
@ -119,7 +134,10 @@ class Contentpart extends Component {
</div> </div>
); );
const buttonWidth = 70;
console.log("Contentpart.js");
console.log(this.props.defaultActiveKey);
return ( return (
<div className=" clearfix mt25"> <div className=" clearfix mt25">
<div className="educontent mt10 pb20 w1200s"> <div className="educontent mt10 pb20 w1200s">

@ -51,20 +51,6 @@ class Testpaperlibrary extends Component {
//初始化 //初始化
componentDidMount() { componentDidMount() {
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
let {defaultActiveKey} = this.state;
var defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
this.setState({
defaultActiveKey:defaultActiveKeys
})
let url = `/users/get_navigation_info.json`; let url = `/users/get_navigation_info.json`;
axios.get(url, {}).then((response) => { axios.get(url, {}).then((response) => {
// ////console.log("开始请求/get_navigation_info.json"); // ////console.log("开始请求/get_navigation_info.json");
@ -78,7 +64,6 @@ class Testpaperlibrary extends Component {
} }
} }
}); });
//获取题库筛选资料 //获取题库筛选资料
let urls = `/disciplines.json`; let urls = `/disciplines.json`;
axios.get(urls, {params: { axios.get(urls, {params: {
@ -90,18 +75,6 @@ class Testpaperlibrary extends Component {
}) })
} }
}); });
var data={
discipline_id:this.state.discipline_id,
sub_discipline_id:this.state.sub_discipline_id,
tag_discipline_id:this.state.tag_discipline_id,
public: defaultActiveKeys,
difficulty: this.state.difficulty,
keywords: this.state.keywords,
page: 1,
per_page:10,
}
this.getdata(data);
} }
paginationonChange=(pages)=>{ paginationonChange=(pages)=>{

@ -38,6 +38,22 @@ class Contentpart extends Component {
} }
componentDidUpdate(prevProps) {
if(prevProps.current_user !== this.props.current_user) {
const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false;
let {defaultActiveKey} = this.props;
var defaultActiveKeys=defaultActiveKey;
if(isysladmins===true||(is_teacher===true&&professional_certification===true)){
defaultActiveKeys="0"
}else{
defaultActiveKeys="1"
}
this.props.callback(defaultActiveKeys);
}
}
render() { render() {
let {page}=this.state; let {page}=this.state;
let {defaultActiveKey}=this.props; let {defaultActiveKey}=this.props;
@ -62,6 +78,8 @@ class Contentpart extends Component {
<p className="questiontypeheng"></p> <p className="questiontypeheng"></p>
</div> </div>
); );
return ( return (
<div className=" clearfix mt25"> <div className=" clearfix mt25">
<div className="educontent mt10 pb20 w1200s"> <div className="educontent mt10 pb20 w1200s">

Loading…
Cancel
Save