|
@@ -5,7 +5,7 @@ import ajax from 'jquery/src/ajax/xhr.js';
|
|
|
import $ from 'jquery/src/ajax';
|
|
|
|
|
|
const Star = React.createClass({
|
|
|
- loadData(pageNo) {
|
|
|
+ loadUserData(pageNo) {
|
|
|
this.setState({
|
|
|
loading: true
|
|
|
});
|
|
@@ -15,6 +15,13 @@ const Star = React.createClass({
|
|
|
crossDomain: false,
|
|
|
url: globalConfig.context + '/api/admin/star/list',
|
|
|
data: {
|
|
|
+ pageNo: pageNo || 1,
|
|
|
+ pageSize: this.state.userPagination.pageSize,
|
|
|
+ number: this.state.searchUserNumber, //编号
|
|
|
+ username: this.state.searchUserName, //名称
|
|
|
+ engagedField: this.state.searchField ? this.state.searchField.join(',') : undefined,
|
|
|
+ professionalTitle: this.state.searchPfs,
|
|
|
+ workUnit: this.state.searchUnit
|
|
|
},
|
|
|
success: function (data) {
|
|
|
let theArr = [];
|
|
@@ -36,9 +43,143 @@ const Star = React.createClass({
|
|
|
achievementNums: thisdata.achievementNums,
|
|
|
});
|
|
|
};
|
|
|
+ this.state.userPagination.current = data.data.pageNo;
|
|
|
+ this.state.userPagination.total = data.data.totalCount;
|
|
|
};
|
|
|
this.setState({
|
|
|
- dataSource: theArr
|
|
|
+ dataSource: theArr,
|
|
|
+ userPagination: this.state.userPagination
|
|
|
+ });
|
|
|
+ }.bind(this),
|
|
|
+ }).always(function () {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ loadLectureData(pageNo) {
|
|
|
+ this.setState({
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + '/api/admin/lecture/list',
|
|
|
+ data: {
|
|
|
+ pageNo: pageNo || 1,
|
|
|
+ pageSize: this.state.lecturePagination.pageSize,
|
|
|
+ username: this.state.searchLectureUser, //用户名称
|
|
|
+ name: this.state.searchLectureName, //讲座名称
|
|
|
+ startLectureTime: this.state.startTime ? this.state.startTime.format("yyyy-MM-dd HH:MM:SS") : undefined,
|
|
|
+ endLectureTime: this.state.endTime ? this.state.endTime.format("yyyy-MM-dd HH:MM:SS") : undefined,
|
|
|
+ },
|
|
|
+ success: function (data) {
|
|
|
+ let theArr = [];
|
|
|
+ if (!data.data || !data.data.list) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < data.data.list.length; i++) {
|
|
|
+ let thisdata = data.data.list[i];
|
|
|
+ theArr.push({
|
|
|
+ id: thisdata.id,
|
|
|
+ uid: thisdata.uid,
|
|
|
+ lectureTime: thisdata.lectureTime,
|
|
|
+ name: thisdata.name,
|
|
|
+ summary: thisdata.summary,
|
|
|
+ username: thisdata.username,
|
|
|
+ lectureUrl: thisdata.lectureUrl,
|
|
|
+ lectureTimeFormattedDate: thisdata.lectureTimeFormattedDate,
|
|
|
+ });
|
|
|
+ };
|
|
|
+ this.state.lecturePagination.current = data.data.pageNo;
|
|
|
+ this.state.lecturePagination.total = data.data.totalCount;
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ lectureTableData: theArr,
|
|
|
+ lecturePagination: this.state.lecturePagination
|
|
|
+ });
|
|
|
+ }.bind(this),
|
|
|
+ }).always(function () {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ loadHotData() {
|
|
|
+ this.setState({
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + '/api/admin/star/hotList',
|
|
|
+ success: function (data) {
|
|
|
+ let theArr = [];
|
|
|
+ if (!data.data) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < data.data.length; i++) {
|
|
|
+ let thisdata = data.data[i];
|
|
|
+ theArr.push({
|
|
|
+ key: i,
|
|
|
+ uid: thisdata.uid,
|
|
|
+ engagedField: thisdata.engagedField,
|
|
|
+ username: thisdata.username,
|
|
|
+ professionalTitle: thisdata.professionalTitle,
|
|
|
+ workUnit: thisdata.workUnit,
|
|
|
+ number: thisdata.number,
|
|
|
+ achievementNums: thisdata.achievementNums,
|
|
|
+ });
|
|
|
+ };
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ hotTableData: theArr
|
|
|
+ });
|
|
|
+ }.bind(this),
|
|
|
+ }).always(function () {
|
|
|
+ this.setState({
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+ }.bind(this));
|
|
|
+ },
|
|
|
+ loadStarData() {
|
|
|
+ this.setState({
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ crossDomain: false,
|
|
|
+ url: globalConfig.context + '/api/admin/star/starList',
|
|
|
+ success: function (data) {
|
|
|
+ let theArr = [];
|
|
|
+ if (!data.data) {
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < data.data.length; i++) {
|
|
|
+ let thisdata = data.data[i];
|
|
|
+ theArr.push({
|
|
|
+ key: i,
|
|
|
+ uid: thisdata.uid,
|
|
|
+ engagedField: thisdata.engagedField,
|
|
|
+ username: thisdata.username,
|
|
|
+ professionalTitle: thisdata.professionalTitle,
|
|
|
+ workUnit: thisdata.workUnit,
|
|
|
+ number: thisdata.number,
|
|
|
+ achievementNums: thisdata.achievementNums,
|
|
|
+ });
|
|
|
+ };
|
|
|
+ };
|
|
|
+ this.setState({
|
|
|
+ starTableData: theArr
|
|
|
});
|
|
|
}.bind(this),
|
|
|
}).always(function () {
|
|
@@ -50,26 +191,100 @@ const Star = React.createClass({
|
|
|
getInitialState() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
+ addVisible: false,
|
|
|
hotSelectedRowKeys: [],
|
|
|
hotSelectedRows: [],
|
|
|
starSelectedRowKeys: [],
|
|
|
starSelectedRows: [],
|
|
|
- columns: [{
|
|
|
- title: '活动标题',
|
|
|
- dataIndex: 'title',
|
|
|
- key: 'title',
|
|
|
- render: (text, record, index) => {
|
|
|
- return <Input value={record.title} onChange={(e) => { record.title = e.target.value; this.setState({ data: this.state.data }); }} />
|
|
|
+ userPagination: {
|
|
|
+ defaultCurrent: 1,
|
|
|
+ defaultPageSize: 10,
|
|
|
+ showQuickJumper: true,
|
|
|
+ pageSize: 10,
|
|
|
+ onChange: function (page) {
|
|
|
+ this.loadUserData(page);
|
|
|
+ }.bind(this),
|
|
|
+ showTotal: function (total) {
|
|
|
+ return '共' + total + '条数据';
|
|
|
}
|
|
|
- }, {
|
|
|
- title: '活动简介',
|
|
|
- dataIndex: 'dis',
|
|
|
- key: 'dis',
|
|
|
- render: (text, record, index) => {
|
|
|
- return <Input type="area" span={4} value={record.url} onChange={(e) => { record.url = e.target.value; this.setState({ data: this.state.data }); }} />
|
|
|
+ },
|
|
|
+ lecturePagination: {
|
|
|
+ defaultCurrent: 1,
|
|
|
+ defaultPageSize: 10,
|
|
|
+ showQuickJumper: true,
|
|
|
+ pageSize: 10,
|
|
|
+ onChange: function (page) {
|
|
|
+ this.loadLectureData(page);
|
|
|
+ }.bind(this),
|
|
|
+ showTotal: function (total) {
|
|
|
+ return '共' + total + '条数据';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ userColumns: [
|
|
|
+ {
|
|
|
+ title: '编号',
|
|
|
+ dataIndex: 'number',
|
|
|
+ key: 'number',
|
|
|
+ }, {
|
|
|
+ title: '姓名',
|
|
|
+ dataIndex: 'username',
|
|
|
+ key: 'username',
|
|
|
+ }, {
|
|
|
+ title: '从事领域',
|
|
|
+ dataIndex: 'engagedField',
|
|
|
+ key: 'engagedField',
|
|
|
+ }, {
|
|
|
+ title: '职称名字',
|
|
|
+ dataIndex: 'professionalTitle',
|
|
|
+ key: 'professionalTitle',
|
|
|
+ }, {
|
|
|
+ title: '工作单位',
|
|
|
+ dataIndex: 'workUnit',
|
|
|
+ key: 'workUnit',
|
|
|
+ }, {
|
|
|
+ title: '成果数量',
|
|
|
+ dataIndex: 'achievementNums',
|
|
|
+ key: 'achievementNums',
|
|
|
+ }, {
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'action',
|
|
|
+ key: 'action',
|
|
|
+ render: (text, record, index) => {
|
|
|
+ return <div>
|
|
|
+ <Button onClick={() => { this.addIndex(record) }} type="primary" style={{ marginRight: '10px' }}>添加到大咖说</Button>
|
|
|
+ <Button onClick={() => { this.addStar(record) }} type="primary">添加到明星页</Button>
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ lectureColumns: [
|
|
|
+ {
|
|
|
+ title: '讲堂名称',
|
|
|
+ dataIndex: 'name',
|
|
|
+ key: 'name',
|
|
|
+ }, {
|
|
|
+ title: '开讲人姓名',
|
|
|
+ dataIndex: 'username',
|
|
|
+ key: 'username',
|
|
|
+ }, {
|
|
|
+ title: '描述',
|
|
|
+ dataIndex: 'summary',
|
|
|
+ key: 'summary',
|
|
|
+ }, {
|
|
|
+ title: '展示图',
|
|
|
+ dataIndex: 'lectureUrl',
|
|
|
+ key: 'lectureUrl',
|
|
|
+ render: text => {
|
|
|
+ if (text) {
|
|
|
+ return '已上传'
|
|
|
+ } else {
|
|
|
+ return '未上传'
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
- }],
|
|
|
- dataSource: [],
|
|
|
+ ],
|
|
|
+ userTableData: [],
|
|
|
+ lectureTableData: [],
|
|
|
hotTableData: [],
|
|
|
starTableData: []
|
|
|
};
|
|
@@ -95,7 +310,7 @@ const Star = React.createClass({
|
|
|
},
|
|
|
addStar(record) {
|
|
|
let theBool = true;
|
|
|
- this.state.starTableData.map(item => {
|
|
|
+ this.state.starTableData.map((item, i) => {
|
|
|
if (item.uid == record.uid) {
|
|
|
message.warning('该条记录已经存在于明星列表中!');
|
|
|
theBool = false;
|
|
@@ -148,6 +363,8 @@ const Star = React.createClass({
|
|
|
},
|
|
|
componentWillMount() {
|
|
|
this.loadData();
|
|
|
+ this.loadHotData();
|
|
|
+ this.loadStarData();
|
|
|
},
|
|
|
submit() {
|
|
|
let hotArr = [], starArr = [];
|
|
@@ -175,15 +392,12 @@ const Star = React.createClass({
|
|
|
crossDomain: false,
|
|
|
url: globalConfig.context + '/api/admin/star/save',
|
|
|
data: {
|
|
|
- star: starArr,
|
|
|
+ data: JSON.stringify(starArr),
|
|
|
hot: hotArr
|
|
|
},
|
|
|
success: function (data) {
|
|
|
- let theArr = [];
|
|
|
- if (!data.data || !data.data.list) {
|
|
|
- if (data.error && data.error.length) {
|
|
|
- message.warning(data.error[0].message);
|
|
|
- };
|
|
|
+ if (data.error && data.error.length) {
|
|
|
+ message.warning(data.error[0].message);
|
|
|
} else {
|
|
|
message.success('保存成功!')
|
|
|
};
|
|
@@ -194,6 +408,23 @@ const Star = React.createClass({
|
|
|
});
|
|
|
}.bind(this));
|
|
|
},
|
|
|
+ search() {
|
|
|
+ this.loadData();
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ this.state.searchPfs = undefined;
|
|
|
+ this.state.searchUnit = undefined;
|
|
|
+ this.state.searchNumber = undefined;
|
|
|
+ this.state.searchName = undefined;
|
|
|
+ this.state.searchField = [];
|
|
|
+ this.loadData();
|
|
|
+ },
|
|
|
+ userTableRowClick(record, index) {
|
|
|
+ this.state.userData = record;
|
|
|
+ this.setState({
|
|
|
+ addVisible: true
|
|
|
+ });
|
|
|
+ },
|
|
|
render() {
|
|
|
const hotRowSelection = {
|
|
|
selectedRowKeys: this.state.hotSelectedRowKeys,
|
|
@@ -219,35 +450,94 @@ const Star = React.createClass({
|
|
|
<div className="admin-content" >
|
|
|
<div className="admin-content-title">科技讲堂管理</div>
|
|
|
<div className="admin-content-warp">
|
|
|
- <div className="admin-content-header">
|
|
|
- <span>大咖显示列表</span>
|
|
|
- <Button type='danger' disabled={!hotHasSelected} onClick={this.hotDelectRow}>
|
|
|
- 删除<Icon type="minus" />
|
|
|
- </Button>
|
|
|
+ <div className="admin-content-header">专家明星列表</div>
|
|
|
+ <div className="admin-content-search">
|
|
|
+ <Input placeholder="编号" style={{ width: 100 }}
|
|
|
+ value={this.state.searchUserNumber}
|
|
|
+ onChange={(e) => { this.setState({ searchUserNumber: e.target.value }); }} />
|
|
|
+ <Input placeholder="专家明星名称" style={{ width: 160 }}
|
|
|
+ value={this.state.searchUserName}
|
|
|
+ onChange={(e) => { this.setState({ searchUserName: e.target.value }); }} />
|
|
|
+ <Cascader placeholder="请选择一个行业" style={{ width: 300 }}
|
|
|
+ options={techFieldList}
|
|
|
+ value={this.state.searchField}
|
|
|
+ onChange={(e) => { this.setState({ searchField: e }) }} />
|
|
|
+ <Input placeholder="职称名字" style={{ width: 160 }}
|
|
|
+ value={this.state.searchPfs}
|
|
|
+ onChange={(e) => { this.setState({ searchPfs: e.target.value }); }} />
|
|
|
+ <Input placeholder="工作单位" style={{ width: 160 }}
|
|
|
+ value={this.state.searchUnit}
|
|
|
+ onChange={(e) => { this.setState({ searchUnit: e.target.value }); }} />
|
|
|
+ <Button type="primary" onClick={this.search}>搜索</Button>
|
|
|
+ <Button onClick={this.reset}>重置</Button>
|
|
|
</div>
|
|
|
<Spin spinning={this.state.loading}>
|
|
|
- <Table columns={this.state.columns}
|
|
|
- dataSource={this.state.hotTableData}
|
|
|
- rowSelection={hotRowSelection}
|
|
|
- pagination={false} />
|
|
|
+ <Table columns={this.state.userColumns}
|
|
|
+ dataSource={this.state.userTableData}
|
|
|
+ pagination={this.state.userPagination}
|
|
|
+ onRowClick={this.userTableRowClick} />
|
|
|
</Spin>
|
|
|
</div>
|
|
|
- <div className="admin-content-warp">
|
|
|
- <div className="admin-content-header">
|
|
|
- <span>明星显示列表</span>
|
|
|
- <Button type='danger' disabled={!starHasSelected} onClick={this.starDelectRow}>
|
|
|
- 删除<Icon type="minus" />
|
|
|
- </Button>
|
|
|
+ <div className="clearfix">
|
|
|
+ <div className="admin-content-warp" style={{ width: '50%', float: 'left' }}>
|
|
|
+ <div className="admin-content-header">
|
|
|
+ <span>讲堂列表</span>
|
|
|
+ <Button type='danger' disabled={!hotHasSelected} onClick={this.hotDelectRow}>
|
|
|
+ 删除<Icon type="minus" />
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ <Spin spinning={this.state.loading}>
|
|
|
+ <Table columns={this.state.lectureColumns}
|
|
|
+ dataSource={this.state.lectureTableData}
|
|
|
+ rowSelection={hotRowSelection}
|
|
|
+ pagination={this.state.lecturePagination} />
|
|
|
+ </Spin>
|
|
|
+ </div>
|
|
|
+ <div className="admin-content-warp" style={{ width: '50%', float: 'left' }}>
|
|
|
+ <div className="admin-content-header">
|
|
|
+ <span>明星显示列表</span>
|
|
|
+ <Button type='danger' disabled={!starHasSelected} onClick={this.starDelectRow}>
|
|
|
+ 删除<Icon type="minus" />
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ <Spin spinning={this.state.loading}>
|
|
|
+ <Table columns={this.state.otherColumns}
|
|
|
+ dataSource={this.state.starTableData}
|
|
|
+ rowSelection={starRowSelection}
|
|
|
+ pagination={false} />
|
|
|
+ </Spin>
|
|
|
</div>
|
|
|
- <Spin spinning={this.state.loading}>
|
|
|
- <Table columns={this.state.columns}
|
|
|
- dataSource={this.state.starTableData}
|
|
|
- rowSelection={starRowSelection}
|
|
|
- pagination={false} />
|
|
|
- </Spin>
|
|
|
</div>
|
|
|
<Button onClick={this.submit} type="primary" style={{ marginTop: '20px' }}>保存</Button>
|
|
|
- </div >
|
|
|
+ <Modal
|
|
|
+ title="新建科技讲堂" width={600}
|
|
|
+ visible={this.state.addVisible}
|
|
|
+ footer={null}
|
|
|
+ onCancel={() => { this.setState({ addVisible: false }) }} >
|
|
|
+ <div className="modal-box">
|
|
|
+ <span className="modal-box-title">开讲人</span>
|
|
|
+ <div className="modal-box-detail">
|
|
|
+ {this.state.userData.name}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="modal-box">
|
|
|
+ <span className="modal-box-title">讲堂标题</span>
|
|
|
+ <div className="modal-box-detail">
|
|
|
+ <Input value={this.state.addModal.title}
|
|
|
+ onChange={(e) => {
|
|
|
+ this.state.addModal.title = e.target.value;
|
|
|
+ this.setState({ addModal: this.state.addModal });
|
|
|
+ }} />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="modal-box">
|
|
|
+ <span className="modal-box-title">开讲时间</span>
|
|
|
+ <div className="modal-box-detail">
|
|
|
+ {this.state.userData.name}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ </div>
|
|
|
);
|
|
|
}
|
|
|
});
|