From ffd13e728a82b0eb42aaedbb7a61452466027fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 23 Jul 2019 12:08:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 13 +++++---- .../courses/coursesPublic/Addcourses.js | 26 +++++++++++++---- .../courses/coursesPublic/PathModal.js | 13 +++++---- .../paths/PathDetail/DetailCardsEditAndAdd.js | 28 +++++++++---------- .../modules/tpm/TPMsettings/TPMsettings.js | 10 ++++--- .../src/modules/tpm/newshixuns/Newshixuns.js | 12 +++++--- 6 files changed, 63 insertions(+), 39 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index d7aa0a540..db6b6f43b 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -13,10 +13,11 @@ import '@icedesign/base/dist/ICEDesignBase.css'; import '@icedesign/base/index.scss'; -import LoginDialog from './modules/login/LoginDialog' -import Notcompletedysl from './modules/user/Notcompletedysl' -import Trialapplicationysl from './modules/login/Trialapplicationysl' -import Trialapplicationreview from './modules/user/Trialapplicationreview' +import LoginDialog from './modules/login/LoginDialog'; +import Notcompletedysl from './modules/user/Notcompletedysl'; +import Trialapplicationysl from './modules/login/Trialapplicationysl'; +import Trialapplicationreview from './modules/user/Trialapplicationreview'; +import Addcourses from "./modules/courses/coursesPublic/Addcourses"; import Trialapplication from './modules/login/Trialapplication' import NotFoundPage from './NotFoundPage' @@ -41,6 +42,7 @@ import {initAxiosInterceptors} from './AppConfig' // !!!tpi需要这个来加载css import {TPMIndexHOC} from './modules/tpm/TPMIndexHOC'; + const theme = createMuiTheme({ palette: { primary: { @@ -259,7 +261,7 @@ class App extends Component { render() { - // let {isRenders} = this.state; + return ( @@ -270,6 +272,7 @@ class App extends Component { + {/*{*/} {/* isRender === true?*/} {/* : ""*/} diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index b140508d4..886ba2a0e 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -28,6 +28,20 @@ class Addcourses extends Component{ } componentDidMount() { + axios.interceptors.response.use((response) => { + if (response != undefined) + if (response && response.data.status === 409) { + this.setState({ + Addcoursestypes: true + }) + + } + return response; + }, (error) => { + //TODO 这里如果样式变了会出现css不加载的情况 + + }); + let {Addcoursestype}=this.props; this.setState({ @@ -102,7 +116,7 @@ class Addcourses extends Component{ hidetojoinclass=()=>{ - this.props.hideAddcoursestype(); + // console.log(this.props) this.setState({ invite_code:undefined, @@ -114,9 +128,10 @@ class Addcourses extends Component{ Checkboxteachingtype:false, professor:null, assistant_professor:null, - student:null + student:null, + Addcoursestypes:false }) - + this.props.hideAddcoursestype(); } submitasyn=(course_id)=>{ @@ -285,7 +300,8 @@ class Addcourses extends Component{ loadtype, modalsType, modalsTopval, - modalSave + modalSave, + Addcoursestypes }=this.state; const antIcon = ; return( @@ -301,7 +317,7 @@ class Addcourses extends Component{ keyboard={false} className={"HomeworkModal"} title="加入课堂" - visible={Addcoursestype} + visible={Addcoursestype===undefined?Addcoursestypes:Addcoursestype} closable={false} footer={null} destroyOnClose={true} diff --git a/public/react/src/modules/courses/coursesPublic/PathModal.js b/public/react/src/modules/courses/coursesPublic/PathModal.js index 824c50c78..10a298c90 100644 --- a/public/react/src/modules/courses/coursesPublic/PathModal.js +++ b/public/react/src/modules/courses/coursesPublic/PathModal.js @@ -91,7 +91,7 @@ class PathModal extends Component{ this.setState({ type:types, page:1, - newshixunmodallist:undefined + newshixunmodallist:[] }) this.funshixunpathlist(Searchvalue,types,true,1) } @@ -103,10 +103,11 @@ class PathModal extends Component{ }) } SenttotheSearch=(value)=>{ + this.setState({ + page:1, + newshixunmodallist:[] + }) let{type}=this.state; - this.setState({ - page:1, - }) this.funshixunpathlist(value,type,true,1) } @@ -269,7 +270,7 @@ class PathModal extends Component{ `} -
@@ -298,7 +299,7 @@ class PathModal extends Component{ }) } -
+ } { this.state.patheditarrytype===true?{this.state.patheditarryvalue}:""}
取消 diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js index e47fe5a0f..fc0a0fea9 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js @@ -142,11 +142,15 @@ class DetailCardsEditAndAdd extends Component{ //打开选择实训弹框初始化tag标签和列表 changeTag=(id,search)=>{ - this.setState({ - hometypepvisible:true, - }) - let pathId=this.props.pathid; - let {page}=this.state; + + this.setState({ + ChooseShixunListshixun_list:[], + page:1, + hometypepvisible:true, + }) + + let pathId=this.props.pathid; + let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+1 if(search!="" && search!=undefined){ url+="&search="+search; @@ -157,11 +161,6 @@ class DetailCardsEditAndAdd extends Component{ axios.get(url).then((result)=>{ if(result.status===200){ - this.setState({ - ChooseShixunListshixun_list:[], - page:1 - }) - this.setState({ ChooseShixunList:result.data, hometypepvisible:false, @@ -296,11 +295,10 @@ class DetailCardsEditAndAdd extends Component{ contentViewScrolladd=(e)=>{ - let {page}=this.state; //滑动到底判断 if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ // console.log("到达底部"); - if(page!=1){ + debugger this.setState({ hometypepvisible:true }) @@ -334,7 +332,7 @@ class DetailCardsEditAndAdd extends Component{ }).catch((error)=>{ console.log(error); }) - } + } @@ -493,7 +491,7 @@ class DetailCardsEditAndAdd extends Component{ ` } -
@@ -520,7 +518,7 @@ class DetailCardsEditAndAdd extends Component{ }) } -
+
}
取消 确定 diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index 72bbbe3d0..ed1249f0d 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -392,10 +392,12 @@ export default class TPMsettings extends Component { let departmentsUrl = `/shixuns/departments.json`; axios.get(departmentsUrl).then((response) => { if (response.status === 200) { - this.setState({ - departmentslist: response.data.shools_name - }); - } + if (response.data.message === undefined) { + this.setState({ + departmentslist: response.data.shools_name + }); + } + } }).catch((error) => { console.log(error) }); diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index 956e652c8..cb0f08c0f 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -251,9 +251,11 @@ class Newshixuns extends Component { let departmentsUrl = `/shixuns/departments.json`; axios.get(departmentsUrl).then((response) => { if (response.status === 200) { - this.setState({ - departmentslist: response.data.shools_name - }); + if (response.data.message===undefined) { + this.setState({ + departmentslist: response.data.shools_name + }); + } } }).catch((error) => { console.log(error) @@ -496,7 +498,9 @@ class Newshixuns extends Component { function fake() { let departmentsUrl = `/shixuns/departments.json?q=` + currentValue; axios.get(departmentsUrl).then((response) => { - callback(response.data.shools_name); + if (response.data.message===undefined) { + callback(response.data.shools_name); + } }).catch((error) => { console.log(error) });