star.jsx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import React from 'react';
  2. import { Icon, Button, Spin, message, Table } from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. const Star = React.createClass({
  6. loadData() {
  7. this.setState({
  8. loading: true
  9. });
  10. $.ajax({
  11. method: "get",
  12. dataType: "json",
  13. crossDomain: false,
  14. url: globalConfig.context + '',
  15. data: {
  16. },
  17. success: function (data) {
  18. let theArr = [];
  19. }.bind(this),
  20. }).always(function () {
  21. this.setState({
  22. loading: false
  23. });
  24. }.bind(this));
  25. },
  26. getInitialState() {
  27. return {
  28. loading: false,
  29. selectedRowKeys: [],
  30. selectedRows: [],
  31. columns: [
  32. {
  33. title: '姓名',
  34. dataIndex: 'name',
  35. key: 'name',
  36. }, {
  37. title: '从事领域',
  38. dataIndex: 'field',
  39. key: 'field',
  40. }, {
  41. title: '职称名字',
  42. dataIndex: 'keyword',
  43. key: 'keyword',
  44. }, {
  45. title: '工作单位',
  46. dataIndex: 'unit',
  47. key: 'unit',
  48. }
  49. ],
  50. dataSource: []
  51. };
  52. },
  53. componentWillMount() {
  54. this.loadData();
  55. },
  56. componentWillReceiveProps(nextProps) {
  57. },
  58. render() {
  59. const rowSelection = {
  60. selectedRowKeys: this.state.selectedRowKeys,
  61. onChange: (selectedRowKeys, selectedRows) => {
  62. this.setState({
  63. selectedRows: selectedRows.slice(-1),
  64. selectedRowKeys: selectedRowKeys.slice(-1)
  65. });
  66. }
  67. };
  68. const hasSelected = this.state.selectedRowKeys.length > 0;
  69. return (
  70. <div className="admin-content" >
  71. <div className="admin-content-title">科技明星管理</div>
  72. <div className="admin-content-warp">
  73. <div>专家列表</div>
  74. <div className="user-search">
  75. <Input placeholder="编号"
  76. value={this.state.searchNumber}
  77. onChange={(e) => { this.setState({ searchNumber: e.target.value }); }} />
  78. <Input placeholder="用户名"
  79. value={this.state.username}
  80. onChange={(e) => { this.setState({ username: e.target.value }); }} />
  81. <Input placeholder="职称名字"
  82. value={this.state.keyword}
  83. onChange={(e) => { this.setState({ keyword: e.target.value }); }} />
  84. <Input placeholder="工作单位"
  85. value={this.state.searchName}
  86. onChange={(e) => { this.setState({ searchName: e.target.value }); }} />
  87. <Button type="primary" onClick={this.search}>搜索</Button>
  88. <Button onClick={this.reset}>重置</Button>
  89. </div>
  90. <Spin spinning={this.state.loading}>
  91. <Table columns={this.state.columns}
  92. dataSource={this.state.dataSource}
  93. pagination={this.state.pagination} />
  94. </Spin>
  95. </div>
  96. </div >
  97. );
  98. }
  99. });
  100. export default Star;