| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 | import React from 'react';import { Spin, Button, Tabs, Table, message } from 'antd';import ajax from 'jquery/src/ajax/xhr.js'import $ from 'jquery/src/ajax';import '../content.less';import './content.less';import LeftTab from './leftTab.jsx';const TabPane = Tabs.TabPane;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 + '条数据';                }            },            UnreadPagination: {                defaultCurrent: 1,                defaultPageSize: 10,                showQuickJumper: true,                pageSize: 10,                onChange: function (page) {                    this.loadUnread(page);                }.bind(this),                showTotal: function (total) {                    return '共' + total + '条数据';                }            },            columns: [                {                    title: '编号',                    dataIndex: 'key',                    key: 'key'                }, {                    title: '类型',                    dataIndex: 'noticeType',                    key: 'noticeType',                    render: (text, record) => {                        switch (text) {                            case 1:                                return <a href={globalConfig.context + "/admin/servicesManage/patent.html?rid=" + record.rid + "&uid=" + record.uid + "#comprehensive"}> {record.noticeTypeName} </a>;                            case 3:                                return <a href={globalConfig.context + "/admin/servicesManage/copyright.html?rid=" + record.rid + "&uid=" + record.uid + "#copyright"}> {record.noticeTypeName} </a>;                            case 2:                                return <a href={globalConfig.context + "/admin/servicesManage/highTech.html?rid=" + record.rid + "&uid=" + record.uid + "&year=" + record.year + "#highTechApply"}> {record.noticeTypeName} </a>;                            case 4:                                return <a href={globalConfig.context + "/admin/servicesManage/technology.html?rid=" + record.rid + "&uid=" + record.uid + "#applyManage"}> {record.noticeTypeName} </a>;                            case 5:                                return <a href={globalConfig.context + "/admin/userManage.html?id=" + record.uid + "&type=0" + (window.showUserList ? "#userList" : "#customerList")}> {record.noticeTypeName} </a>;                            case 6:                                return <a href={globalConfig.context + "/admin/userManage.html?id=" + record.uid + "&type=1" + (window.showOrgList ? "#orgList" : "#customerList")}> {record.noticeTypeName} </a >;                            case 7:                                return <a href={globalConfig.context + "/admin/servicesManage/contract.html?rid=" + record.rid + "&uid=" + record.uid + "#contract"}> {record.noticeTypeName} </a >;                            case 8:                                return <a href={globalConfig.context + "/admin/demand.html?rid=" + record.rid + "#techDemandUser"}> {record.noticeTypeName} </a >;                            case 9:                                return <a href={globalConfig.context + "/admin/demand.html?rid=" + record.rid + "&uid=" + record.uid + "#techDemandOrg"}> {record.noticeTypeName} </a >;                            case 10:                                return <a href={globalConfig.context + "/admin/achievement.html?rid=" + record.rid + "#orgTechAchievement"}> {record.noticeTypeName} </a >;                            case 11:                                return <a href={globalConfig.context + "/admin/achievement.html?rid=" + record.rid + "#userTechAchievement"}> {record.noticeTypeName} </a >;                        }                    }                }, {                    title: '时间',                    dataIndex: 'createTimeFormattedDate',                    key: 'createTimeFormattedDate'                }, {                    title: '内容',                    dataIndex: 'content',                    key: 'content',                }, {                    title: '公司',                    dataIndex: 'unitName',                    key: 'unitName',                }, {                    title: '业务员',                    dataIndex: 'principle',                    key: 'principle',                }            ],            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,                    rid: thisdata.rid,                    uid: thisdata.uid,                    aid: thisdata.aid,                    noticeType: thisdata.noticeType,                    year: thisdata.year,                    noticeTypeName: thisdata.noticeTypeName,                    content: thisdata.content,                    createTime: thisdata.createTime,                    createTimeFormattedDate: thisdata.createTimeFormattedDate,                    principle: thisdata.principle,                    unitName: thisdata.unitName                });            };            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(pageNo) {        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.UnreadPagination.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,                    rid: thisdata.rid,                    uid: thisdata.uid,                    aid: thisdata.aid,                    noticeType: thisdata.noticeType,                    year: thisdata.year,                    noticeTypeName: thisdata.noticeTypeName,                    content: thisdata.content,                    createTime: thisdata.createTime,                    createTimeFormattedDate: thisdata.createTimeFormattedDate,                    principle: thisdata.principle,                    unitName: thisdata.unitName                });            };            this.state.UnreadPagination.current = data.data.pageNo;            this.state.UnreadPagination.total = data.data.totalCount;            this.setState({                unreadData: this.state.data,                UnreadPagination: this.state.UnreadPagination            });        }).always(function () {            this.setState({                loading: false            });        }.bind(this));    },    componentWillMount() {        this.loadReaded();        this.loadUnread();    },    render() {        return (            <div className="set-content">                <div className="set-title">                    <span>管理员中心</span>                </div>                <Spin spinning={this.state.loading} className='spin-box'>                    <Tabs defaultActiveKey="1">                        <Tabs.TabPane tab="新信息" key="1">                            <Table columns={this.state.columns}                                dataSource={this.state.unreadData}                                pagination={this.state.UnreadPagination} />                        </Tabs.TabPane>                        <Tabs.TabPane tab="已读信息" key="2">                            <Table columns={this.state.columns}                                dataSource={this.state.dataSource}                                pagination={this.state.pagination} />                        </Tabs.TabPane>                    </Tabs>                </Spin>            </div>        );    }});const Content = React.createClass({    getInitialState() {        return {            loading: false        };    },    render() {        return (            <div className="manage-content">                <LeftTab handlekey={this.handlekey} />                <div className="content-right">                    <Spin spinning={this.state.loading} className='spin-box'>                        <div className="index-content">                            <MessageModal />                        </div>                    </Spin>                </div>            </div>        )    }});export default Content;// <div className="index-content">//                             <div className="index-userdata clearfix">//                                 <p className="acc-title">{this.state.number}</p>//                                 <div className="userdata-img">//                                     <img src={globalConfig.staticHost + "/upload" + this.state.personPortraitUrl} alt="" />//                                 </div>//                                 <div className="userdata-content">//                                     {(() => {//                                         switch (userData.lvl || this.state.userlvl) {//                                             case '0'://                                                 return <p className="userdata-lvl">等级:<span>LV1</span> 普通用户</p>;//                                             case '1'://                                                 return <p className="userdata-lvl">等级:<span>LV2</span> 已认证用户</p>;//                                         };//                                     })()}//                                     <p>完善资料 {this.state.per}% ,<a href="./set.html">继续完善</a>,有助于提高您的资信</p>//                                     <p className="userdata-relate" style={{ 'display': 'none' }}>//                                         <Button className="relateqq"><img src={qq} alt="" /> QQ账号登录</Button>//                                         <Button className="relateweibo"><img src={weibo} alt="" />微博账号登录</Button>//                                         <Button className="relateweixin"><img src={weixin} alt="" />微信账号登录</Button>//                                     </p>//                                     <div className="userdata-follow">已有<a href="">{this.state.follow}</a>人关注你</div>//                                 </div>//                             </div>//                             <div className="index-record">//                                 <p className="acc-title">我的轨迹</p>//                                 <ul className="record-list clearfix">//                                     <li>技术成果:<a href="">{this.state.chengguo}</a>项</li>//                                     <li>技术开发:<a href="">{this.state.kaifa}</a>项</li>//                                     <li>科技服务:<a href="">{this.state.fuwu}</a>项</li>//                                     <li>发布需求:<a href="">{this.state.xuqiu}</a>项</li>//                                 </ul>//                             </div>//                             <div className="index-activity">//                                 <Tabs defaultActiveKey="1" onChange={this.tabChange}>//                                     <TabPane tab="活动" key="1">//                                         <p className="acc-title">即将举办的活动</p>//                                         <ul className="activity-list">//                                             {//                                                 this.state.activityArr.map(function (item, i) {//                                                     return <li key={i}>//                                                         <span className="list-type">[{item.type}]</span>//                                                         <span className="list-title">{item.title}</span>//                                                         <a href={item.link}>报名</a>//                                                         <span className="list-time">{item.time}</span>//                                                     </li>;//                                                 })//                                             }//                                         </ul>//                                     </TabPane>//                                     <TabPane tab="其他" key="2">Content of Tab Pane 2</TabPane>//                                 </Tabs>//                             </div>//                         </div>
 |