import React, { Component } from 'react'; import { Spin, Pagination, } from "antd"; import axios from 'axios'; import {getImageUrl} from 'educoder'; import "../css/messagemy.css" //消息页面 class MessagSub extends Component{ constructor(props) { super(props); this.state={ page:1, limit:10, typeysl:"", count:0, isSpin:false, data:undefined, } } // 初始化数据 componentDidMount(){ // console.log("初始化数据了MessagSub"); // console.log(this.props); this.getdata("",this.state.page); // this.Messageprivatemessageunreadmessage(); try { this.props.Mtab(1); }catch (e) { } } //塞选页数 paginationonChanges=(pageNumber)=>{ this.setState({ page: pageNumber, }) this.getdata(this.state.typeysl,pageNumber); } //获取数据源 getdata=(types,page)=>{ this.setState({ isSpin:true, }) let{limit}=this.state; let url = `/users/tidings.json`; axios.get((url),{params:{ type:types, page:page, per_page:limit, }}).then((result) => { if (result) { // if (result.data.status === 0) { this.setState({ page: page, count: result.data.count, typeysl: types, isSpin: false, data: result.data.tidings === null ? undefined : result.data.tidings === undefined ? undefined : result.data.tidings === [] ? undefined : result.data.tidings === "[]" ? undefined : result.data.tidings.length === 0 ? undefined : result.data.tidings, }) // } } }).catch((error) => { console.log(error); this.setState({ isSpin:false, }) }) } componentWillUnmount(){ // 卸载异步操作设置状态 this.setState = (state, callback) => { return; } } render() { let{page,limit,typeysl,count,isSpin,data}=this.state; // console.log("6868686868"); // console.log(data); return (
暂无数据哦~
this.myCome(item)}>{item.trigger_user.name} {item.time} {item.tiding_type==="Apply"?( item.status===0? 待处理:"" ):""} {item.tiding_type==="Apply"?( item.status===1? 已处理:"" ):""}
{ item.content }