diff --git a/public/react/src/modules/courses/coursesHome/coursesHome.js b/public/react/src/modules/courses/coursesHome/coursesHome.js index 8f139c9bd..6f9e0577c 100644 --- a/public/react/src/modules/courses/coursesHome/coursesHome.js +++ b/public/react/src/modules/courses/coursesHome/coursesHome.js @@ -3,10 +3,12 @@ import {getImageUrl} from 'educoder'; import CoursesHomeCard from "./coursesHomeCard.js" import axios from 'axios'; import {Input,Tooltip} from 'antd'; +import UpgradeModals from '../../modals/UpgradeModals'; import './css/CoursesHome.css'; import Pagination from '@icedesign/base/lib/pagination'; import '@icedesign/base/lib/pagination/style.js'; + const Search = Input.Search; class coursesHome extends Component{ constructor(props) { @@ -51,7 +53,17 @@ class coursesHome extends Component{ } componentDidMount(){ - this.searchcourses(16,1,"all","") + const upsystem=`/users/system_update.json`; + axios.get(upsystem).then((response)=>{ + let updata=response.data; + this.setState({ + updata + }) + }).catch((error)=>{ + console.log(error); + }) + + this.searchcourses(16,1,"all","") } onChange=(pageNumber)=> { @@ -91,10 +103,13 @@ class coursesHome extends Component{ render() { let { order,search,page,coursesHomelist }=this.state; - console.log(coursesHomelist) + return (
- +
diff --git a/public/react/src/modules/modals/UpgradeModals.js b/public/react/src/modules/modals/UpgradeModals.js new file mode 100644 index 000000000..0bf06ff6e --- /dev/null +++ b/public/react/src/modules/modals/UpgradeModals.js @@ -0,0 +1,78 @@ +import React, { Component } from 'react'; +import {getImageUrl} from 'educoder'; +import { Spin, Icon , Modal} from 'antd'; +import moment from 'moment'; +class UpgradeModals extends Component { + constructor(props) { + super(props); + this.state = { + system_updates:false + } + } + + updatasmodals=()=>{ + let {updata} = this.props; + if(updata&&updata.system_update===true){ + let SystemUpdateEndTime = localStorage.getItem('SystemUpdateEndTime'); + if(SystemUpdateEndTime===null){ + this.setState({ + system_updates:true + }) + }else if(moment(SystemUpdateEndTime) < moment(updata.end_time)){ + this.setState({ + system_updates:true + }) + } + } + } + + componentDidMount() { + this.updatasmodals() + } + + componentDidUpdate(prevProps){ + if (prevProps.data!=this.props.updata) { + this.updatasmodals() + } + } + + setmodalSave=()=>{ + let {updata}=this.props; + localStorage.setItem('SystemUpdateEndTime',updata.end_time); + this.setState({ + system_updates:false + }) + } + + +render() { + // const antIcons = + {/**/} + + {/**/} + let {system_updates}=this.state; + let {updata}=this.props; + return( + +
+
{updata&&updata.system_score}
+ +
+
+ ) + } +} + +export default UpgradeModals; \ No newline at end of file diff --git a/public/react/src/modules/paths/ShixunPathSearch.js b/public/react/src/modules/paths/ShixunPathSearch.js index c37754d62..cca9b0e94 100644 --- a/public/react/src/modules/paths/ShixunPathSearch.js +++ b/public/react/src/modules/paths/ShixunPathSearch.js @@ -1,13 +1,15 @@ import React, { Component } from 'react'; -import PathCard from "./ShixunPathCard.js" +import PathCard from "./ShixunPathCard.js"; import axios from 'axios'; import {Input} from 'antd'; +import UpgradeModals from '../modals/UpgradeModals'; import Pagination from '@icedesign/base/lib/pagination'; import '@icedesign/base/lib/pagination/style.js'; -import './ShixunPaths.css' +import './ShixunPaths.css'; const Search = Input.Search; + class ShixunPathSearch extends Component{ constructor(props) { super(props) @@ -65,7 +67,17 @@ class ShixunPathSearch extends Component{ componentDidMount(){ - let { order,select,search,page }=this.state; + const upsystem=`/users/system_update.json`; + axios.get(upsystem).then((response)=>{ + let updata=response.data; + this.setState({ + updata + }) + }).catch((error)=>{ + console.log(error); + }) + + let { order,select,search,page }=this.state; this.getList(order,select,search,page ); } @@ -96,7 +108,10 @@ class ShixunPathSearch extends Component{ let { order,sortList,search,page,total_count,select }=this.state; return (
- +
diff --git a/public/react/src/modules/tpm/shixuns/ShixunsIndex.js b/public/react/src/modules/tpm/shixuns/ShixunsIndex.js index 5efd31c3b..bbf63ca2d 100644 --- a/public/react/src/modules/tpm/shixuns/ShixunsIndex.js +++ b/public/react/src/modules/tpm/shixuns/ShixunsIndex.js @@ -18,6 +18,8 @@ import ShixunSearchBar from './ShixunSearchBar'; import ShixunCard from './ShixunCard'; +import UpgradeModals from '../../modals/UpgradeModals'; + const queryString = require('query-string'); const $ = window.$; @@ -45,7 +47,20 @@ class ShixunsIndex extends Component { } } componentDidMount(){ - let _keyword; + + const upsystem=`/users/system_update.json`; + axios.get(upsystem).then((response)=>{ + let updata=response.data; + this.setState({ + updata + }) + }).catch((error)=>{ + console.log(error); + }) + + + + let _keyword; if (window.__headSearchKeyword) { this.setState({ keyword: window.__headSearchKeyword }) _keyword = window.__headSearchKeyword @@ -366,6 +381,10 @@ class ShixunsIndex extends Component { return (
+ {/**/} { - this.getInfo(this.props.match.params.username); + const upsystem=`/users/system_update.json`; + axios.get(upsystem).then((response)=>{ + let updata=response.data; + this.setState({ + updata + }) + }).catch((error)=>{ + console.log(error); + }) + + this.getInfo(this.props.match.params.username); } + + //判断是否看的是当前用户的个人主页 componentDidUpdate =(prevProps)=> { if(this.props.current_user && prevProps.current_user != this.props.current_user){ @@ -214,6 +226,10 @@ class Infos extends Component{ moduleName=pathname.split("/")[3]; return(
+ { isRenders && this.cancelModulationModels()}/> }