From 1cd5e2dc9a2ecc0d33d57839ef28bd48834f6be2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 7 Sep 2019 16:39:24 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A2=98=E5=BA=93=E6=9D=83=E9=99=90=E8=B0=83?=
=?UTF-8?q?=E6=95=B4=E8=81=94=E8=B0=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/config/webpack.config.prod.js | 2 +-
.../src/modules/user/usersInfo/InfosBanner.js | 6 +-
.../src/modules/user/usersInfo/InfosCourse.js | 2 +-
.../src/modules/user/usersInfo/InfosTopics.js | 110 ++++++++----------
4 files changed, 54 insertions(+), 66 deletions(-)
diff --git a/public/react/config/webpack.config.prod.js b/public/react/config/webpack.config.prod.js
index d5ad7593a..8cab0465f 100644
--- a/public/react/config/webpack.config.prod.js
+++ b/public/react/config/webpack.config.prod.js
@@ -62,7 +62,7 @@ module.exports = {
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
// devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
- devtool: shouldUseSourceMap ? 'source-map' : 'source-map',//测试版
+ devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
// In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs],
output: {
diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js
index 99afce1d0..4e6492c7f 100644
--- a/public/react/src/modules/user/usersInfo/InfosBanner.js
+++ b/public/react/src/modules/user/usersInfo/InfosBanner.js
@@ -31,8 +31,8 @@ class InfosBanner extends Component{
let user_type=this.props.current_user&&this.props.current_user.user_identity;
let targetuserid=this.props.data&&this.props.data.id;
- // console.log(is_current)
- // console.log(current_user)
+ // console.log(is_current)
+ // console.log(current_user)
// console.log(current_user.is_teacher)
// console.log(current_user.admin)
return(
@@ -124,7 +124,7 @@ class InfosBanner extends Component{
}
{/*自己的主页且不是学生显示题库按钮*/}
- {((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin)
+ {(is_current && current_user)
&&
this.setState({moduleName: 'topics'})}
diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js
index 0f6abc61b..f90b35d09 100644
--- a/public/react/src/modules/user/usersInfo/InfosCourse.js
+++ b/public/react/src/modules/user/usersInfo/InfosCourse.js
@@ -103,7 +103,7 @@ class InfosCourse extends Component{
} = this.state;
let is_current=this.props.is_current;
- console.log(this.props.current_user&&this.props.current_user.user_identity==="学生")
+ // console.log(this.props.current_user&&this.props.current_user.user_identity==="学生")
return(
diff --git a/public/react/src/modules/user/usersInfo/InfosTopics.js b/public/react/src/modules/user/usersInfo/InfosTopics.js
index 5b344270e..8da80aad3 100644
--- a/public/react/src/modules/user/usersInfo/InfosTopics.js
+++ b/public/react/src/modules/user/usersInfo/InfosTopics.js
@@ -31,33 +31,34 @@ class InfosTopics extends Component{
}
componentDidMount(){
- let types=this.props.match.params.topicstype;
- let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
-
- if(professional_certification===false&&types==="publicly"){
- this.setState({
- isshowprofes:true
- })
- }else{
- this.updataslist()
- }
- }
- componentDidUpdate(prevProps) {
-
- if(prevProps.current_user!=this.props.current_user){
- let types=this.props.match.params.topicstype;
- let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
-
- console.log(professional_certification)
- if(professional_certification===false&&types==="publicly"){
- this.setState({
- isshowprofes:true
- })
- }else{
- this.updataslist()
- }
- }
+ // let types=this.props.match.params.topicstype;
+ // let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
+ //
+ // if(professional_certification===false&&types==="publicly"){
+ // this.setState({
+ // isshowprofes:true
+ // })
+ // }else{
+ // this.updataslist()
+ // }
+ this.updataslist()
}
+ // componentDidUpdate(prevProps) {
+ //
+ // if(prevProps.current_user!=this.props.current_user){
+ // let types=this.props.match.params.topicstype;
+ // let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
+ //
+ // console.log(professional_certification)
+ // if(professional_certification===false&&types==="publicly"){
+ // this.setState({
+ // isshowprofes:true
+ // })
+ // }else{
+ // this.updataslist()
+ // }
+ // }
+ // }
updataslist=()=>{
let types=this.props.match.params.topicstype;
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
@@ -65,39 +66,12 @@ class InfosTopics extends Component{
}
searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{
- // if(this.props.current_user.login!=this.props.match.params.username){
- // return
- // }else{
- //
- // }
-
- let types=this.props.match.params.topicstype;
- let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
-
-
- if(professional_certification===false&&types==="publicly"){
-
- }else{
this.setState({
isSpin:true
})
- let types=this.props.match.params.topicstype;
- let user_id="";
-
- if(types==="publicly"){
- user_id=this.props.current_user&&this.props.current_user.login;
- }else{
- user_id=this.props.match.params&&this.props.match.params.username;
- }
-
-
- if(user_id===undefined){
- user_id=1
- }
-
let {per_page}=this.state;
- let url=`/users/${user_id}/question_banks.json`;
+ let url=`/users/question_banks.json`;
axios.get(encodeURI(url),{params:{
type,
@@ -109,19 +83,33 @@ class InfosTopics extends Component{
per_page
}
}).then((response) => {
- this.setState({
- data:response.data,
- checkBoxValues:[],
- isSpin:false
- })
+ if(response){
+ if(response.status){
+ if(response.data.status == -2){
+ this.setState({
+ isshowprofes:true,
+ isSpin:false
+ })
+ }else if(response.data.status === 403||response.data.status === 401||response.data.status === 500){
+ this.setState({
+ isSpin:false
+ })
+ }else{
+ this.setState({
+ data:response.data,
+ checkBoxValues:[],
+ isSpin:false
+ })
+ }
+ }
+ }
+
}).catch((error) => {
this.setState({
isSpin:false
})
});
- }
-
}
searchCategory=(type)=>{