增加升级提示

dev_forum
杨树明 5 years ago
parent 78efd6fcbe
commit 6adbbdc54d

@ -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 (
<div>
<UpgradeModals
{...this.state}
{...this.props}
/>
<div className="newMain clearfix">
<div className="courses-head pr" >
<div className="edu-txt-center pathNavLine">

@ -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 = <Icon type="loading" style={{ fontSize: 24 }} spin />
{/*<Spin indicator={antIcons} spinning={this.state.system_updates} >*/}
{/*</Spin>*/}
let {system_updates}=this.state;
let {updata}=this.props;
return(
<Modal
keyboard={false}
title={updata&&updata.subject}
visible={system_updates}
// visible={this.props.modalsType===undefined?false:this.props.modalsType}
closable={false}
footer={null}
destroyOnClose={true}
centered={true}
width="530px"
>
<div className="task-popup-content">
<pre className="break-word break-word-firefox">{updata&&updata.system_score}</pre>
<div className="clearfix edu-txt-center mt20">
<a className="task-btn task-btn-orange pop_close" onClick={()=>this.setmodalSave()}>知道啦</a>
</div>
</div>
</Modal>
)
}
}
export default UpgradeModals;

@ -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 (
<div>
<UpgradeModals
{...this.state}
{...this.props}
/>
<div className="path-head pr">
<div className="edu-txt-center pathNavLine">
<div className="inline path-nav">

@ -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 (
<div className="newMain clearfix backFAFAFA">
<UpgradeModals
{...this.state}
{...this.props}
/>
{/*<Spin spinning={typepvisible} size="large" style={{marginTop:'15%'}}>*/}
<ShixunSearchBar
Updatasearchlist={this.Updatasearchlist.bind(this)}

@ -5,7 +5,7 @@ import {Tooltip,Menu} from 'antd';
import Loadable from 'react-loadable';
import Loading from '../../../Loading';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import UpgradeModals from '../../modals/UpgradeModals';
import axios from 'axios';
import {getImageUrl} from 'educoder';
import { TPMIndexHOC } from '../../tpm/TPMIndexHOC';
@ -51,8 +51,20 @@ class Infos extends Component{
}
}
componentDidMount =()=>{
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(
<div className="newMain">
<UpgradeModals
{...this.state}
{...this.props}
/>
{
isRenders && <Trialapplication {...this.props} {...this.state} Cancel={() => this.cancelModulationModels()}/>
}

Loading…
Cancel
Save