import React from 'react'; import { Row, Col, Icon, Modal, Button, Spin, Select, Input, message, Badge, Table, Tabs } from 'antd'; import { provinceArr } from '../dataDic.js'; import { companySearch } from '../tools.js'; import './topTab.less'; import ajax from 'jquery/src/ajax/xhr.js' import $ from 'jquery/src/ajax'; import logo from '../../../image/acc-logo.png'; const MessageModal = React.createClass({ getInitialState() { return { visible: false, loading: false, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadReaded(page); }.bind(this), showTotal: function (total) { return '共' + total + '条数据'; } }, columns: [ { title: '编号', dataIndex: 'key', key: 'key' }, { title: '类型', dataIndex: 'noticeType', key: 'noticeType', render: (text) => { switch (text) { case 1: return 专利申请管理 ; case 3: return 软著申请管理 ; case 2: return 高企认定管理 ; case 4: return 科技项目申报管理 ; } } }, { title: '时间', dataIndex: 'createTimeFormattedDate', key: 'createTimeFormattedDate' }, { title: '内容', dataIndex: 'content', key: 'content', } ], data: [] }; }, loadReaded(pageNo) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/notice/readed", data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, } }).done((data) => { if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); return; }; }; this.state.data = []; for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; this.state.data.push({ key: i + 1, id: thisdata.id, aid: thisdata.aid, noticeType: thisdata.noticeType, content: thisdata.content, createTime: thisdata.createTime, createTimeFormattedDate: thisdata.createTimeFormattedDate, }); }; this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; this.setState({ dataSource: this.state.data, pagination: this.state.pagination }); }).always(function () { this.setState({ loading: false }); }.bind(this)); }, loadUnread() { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/notice/unread", // data: { // pageNo: pageNo || 1, // pageSize: this.state.pagination.pageSize, // } }).done((data) => { if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); return; }; }; this.state.data = []; for (let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; this.state.data.push({ key: i + 1, id: thisdata.id, aid: thisdata.aid, noticeType: thisdata.noticeType, content: thisdata.content, createTime: thisdata.createTime, createTimeFormattedDate: thisdata.createTimeFormattedDate, }); }; this.setState({ unreadData: this.state.data }); // this.state.pagination.current = data.data.pageNo; // this.state.pagination.total = data.data.totalCount; // this.setState({ // dataSource: this.state.data, // pagination: this.state.pagination // }); }).always(function () { this.setState({ loading: false }); }.bind(this)); }, componentWillReceiveProps(nextProps) { if (!this.state.visible && nextProps.showDesc) { this.loadReaded(); this.loadUnread(); }; this.state.visible = nextProps.showDesc }, handleOk() { this.setState({ visible: false, }); this.props.closeDesc(false, true); }, handleCancel(e) { this.setState({ visible: false, }); this.props.closeDesc(false, true); }, render() { return (