manage.jsx 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. import React from 'react';
  2. import '../../leftTab.less';
  3. import ReactDom from 'react-dom';
  4. import ajax from 'jquery/src/ajax/xhr.js';
  5. import $ from 'jquery/src/ajax';
  6. import Editors from '../../../richTextEditors'
  7. import '../content.less';
  8. import moment from 'moment';
  9. import { citySelect,provinceList,areaSelect,provinceSelect,addressList} from '../../../NewDicProvinceList';
  10. import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload,Popconfirm,AutoComplete,Tabs,Checkbox,Tree,Cascader} from 'antd';
  11. import {policy} from '../../../dataDic.js';
  12. import {beforeUpload, getBase64,getauditStatus} from '../../../tools.js';
  13. const TabPane = Tabs.TabPane;
  14. const TreeNodet = Tree.TreeNode;
  15. const CheckboxGroup = Checkbox.Group;
  16. const Avatar = React.createClass({
  17. getInitialState() {
  18. return {
  19. imageUrl: ''
  20. }
  21. },
  22. handleChange(info) {
  23. if (info.file.status === 'done') {
  24. // Get this url from response in real world.
  25. getBase64(info.file.originFileObj, imageUrl => this.setState({ imageUrl }));
  26. this.props.urlData(info.file.response.data);
  27. }
  28. },
  29. componentWillReceiveProps(nextProps) {
  30. if (this.props.visible && !nextProps.visible) {
  31. this.state.imageUrl = null;
  32. };
  33. },
  34. render() {
  35. const imageUrl = this.state.imageUrl;
  36. return (
  37. <Upload
  38. className="avatar-uploader"
  39. name={this.props.name}
  40. showUploadList={false}
  41. action={globalConfig.context + "/api/admin/news/upload"}
  42. data={{ 'sign': 'news_title_picture' }}
  43. beforeUpload={beforeUpload}
  44. onChange={this.handleChange} >
  45. {
  46. (imageUrl || this.props.imageUrl) ?
  47. <img src={imageUrl || this.props.imageUrl} role="presentation" id={this.props.name} /> :
  48. <Icon type="plus" className="avatar-uploader-trigger" />
  49. }
  50. </Upload>
  51. );
  52. }
  53. });
  54. const Manage=React.createClass({
  55. loadData(pageNo, theType) {
  56. this.setState({
  57. loading: true,
  58. ispage:pageNo,
  59. });
  60. $.ajax({
  61. method: "get",
  62. dataType: "json",
  63. crossDomain: false,
  64. url: globalConfig.context + '/api/admin/news/list',
  65. data: {
  66. pageNo: pageNo || 1,
  67. pageSize: this.state.pagination.pageSize,
  68. type: theType || 1, //新闻类型
  69. title: this.state.searchTitle,
  70. author: this.state.searchAuthor,
  71. startCreateTime: this.state.startDate, //新闻开始时间 yyyy-MM-dd
  72. endCreateTime: this.state.endDate, //新闻结束时间 yyyy-MM-dd
  73. source: this.state.searchSource,
  74. hot: this.state.searchHot, //是否放在首页
  75. },
  76. success: function (data) {
  77. let theArr = [];
  78. if (!data.data || !data.data.list) {
  79. if (data.error && data.error.length) {
  80. message.warning(data.error[0].message);
  81. };
  82. } else {
  83. for (let i = 0; i < data.data.list.length; i++) {
  84. let thisdata = data.data.list[i];
  85. theArr.push({
  86. key: i,
  87. id: thisdata.id ? thisdata.id.toString() : null,
  88. createTime: thisdata.createTime,
  89. editTime: thisdata.editTime,
  90. title: thisdata.title,
  91. titleImg: thisdata.titleImg,
  92. author: thisdata.author,
  93. type: thisdata.type,
  94. callnubs:thisdata.type,
  95. hot: thisdata.hot,
  96. source: thisdata.source,
  97. sourceUrl: thisdata.sourceUrl,
  98. summary: thisdata.summary,
  99. content: thisdata.content,
  100. createTimeFormattedDate: thisdata.createTimeFormattedDate,
  101. auditStatus:thisdata.auditStatus,
  102. });
  103. };
  104. this.state.pagination.current = data.data.pageNo;
  105. this.state.pagination.total = data.data.totalCount;
  106. };
  107. this.setState({
  108. tableData: theArr,
  109. pagination: this.state.pagination,
  110. });
  111. }.bind(this),
  112. }).always(function () {
  113. this.setState({
  114. loading: false
  115. });
  116. }.bind(this));
  117. },
  118. loadDetailData() {
  119. this.setState({
  120. loading: true
  121. });
  122. $.ajax({
  123. method: "get",
  124. dataType: "json",
  125. crossDomain: false,
  126. url: globalConfig.context + '/api/admin/news/detail',
  127. data: {
  128. id: this.state.RowData.id //新闻主键ID(数字类型,非字符串)
  129. },
  130. success: function (data) {
  131. let theObj = {};
  132. if (!data.data) {
  133. if (data.error && data.error.length) {
  134. message.warning(data.error[0].message);
  135. }
  136. } else {
  137. theObj = data.data;
  138. if(theObj.provinceId==null||theObj.provinceId==''){
  139. theObj.provinceId=11
  140. }
  141. };
  142. this.setState({
  143. RowData: theObj,
  144. topNumber:data.data.topNumber,
  145. hotspot:data.data.hotspot,
  146. callnubs:theObj.type.toString()
  147. });
  148. }.bind(this),
  149. }).always(function () {
  150. this.setState({
  151. loading: false
  152. });
  153. }.bind(this));
  154. },
  155. getInitialState() {
  156. return {
  157. loading: false,
  158. visible: false,
  159. callnub:'1',
  160. selectedRowKeys: [],
  161. selectedRows: [],
  162. keysObj: {},
  163. RowData: {},
  164. pagination: {
  165. defaultCurrent: 1,
  166. defaultPageSize: 10,
  167. showQuickJumper: true,
  168. pageSize: 10,
  169. onChange: function (page) {
  170. this.loadData(page,this.state.callnub);
  171. }.bind(this),
  172. showTotal: function (total) {
  173. return '共' + total + '条数据';
  174. }
  175. },
  176. columns: [
  177. {
  178. title: '标题',
  179. dataIndex: 'title',
  180. key: 'title',
  181. width: '20%'
  182. }, {
  183. title: '发布时间',
  184. dataIndex: 'createTimeFormattedDate',
  185. key: 'createTimeFormattedDate',
  186. }, {
  187. title: '作者',
  188. dataIndex: 'author',
  189. key: 'author',
  190. }, {
  191. title: '审核状态',
  192. dataIndex: 'auditStatus',
  193. key: 'auditStatus',
  194. render: text => { return getauditStatus(text) }
  195. }, {
  196. title: '来源',
  197. dataIndex: 'source',
  198. key: 'source',
  199. }, {
  200. title: '简介',
  201. dataIndex: 'summary',
  202. key: 'summary',
  203. width: '50%'
  204. }
  205. ],
  206. list:provinceList,
  207. tableData: []
  208. };
  209. },
  210. tableRowClick(record, index) {
  211. this.state.RowData = record;
  212. this.loadDetailData();
  213. this.setState({
  214. visible: true
  215. });
  216. },
  217. componentWillMount() {
  218. this.loadData(1,1);
  219. },
  220. componentWillReceiveProps(nextProps) {
  221. if (this.props.newsType != nextProps.newsType) {
  222. this.state.searchTitle = undefined;
  223. this.state.searchAuthor = undefined;
  224. this.state.startDate = undefined;
  225. this.state.endDate = undefined;
  226. this.state.searchSource = undefined;
  227. this.state.searchHot = undefined;
  228. this.loadData(1, nextProps.newsType);
  229. };
  230. },
  231. callback(e) {
  232. this.setState({
  233. callnub: e,
  234. })
  235. if(e == 1) {
  236. this.setState({
  237. })
  238. this.resets();
  239. this.loadData(1,1);
  240. }
  241. if(e == 2) {
  242. this.setState({
  243. })
  244. this.resets();
  245. this.loadData(1,2);
  246. }
  247. if(e == 3) {
  248. this.setState({
  249. })
  250. this.resets();
  251. this.loadData(1,3);
  252. }
  253. if(e == 4) {
  254. this.setState({
  255. })
  256. this.resets();
  257. this.loadData(1,4);
  258. }
  259. if(e == 5) {
  260. this.setState({
  261. })
  262. this.resets();
  263. this.loadData(1,5);
  264. }
  265. },
  266. submit() {
  267. if (!this.state.RowData.title) {
  268. message.warning('必须填写一个标题!');
  269. return;
  270. };
  271. if (!this.state.RowData.createTimeFormattedDate) {
  272. message.warning('必须选择一个发布时间!');
  273. return;
  274. };
  275. if (!this.state.RowData.author) {
  276. message.warning('必须填写一个作者!');
  277. return;
  278. };
  279. // if(this.state.topNumber){
  280. // let topStr = this.state.topNumber.toString();
  281. // let stateReg = topStr.match(/^[0-9]*$/g);
  282. // if(!stateReg){
  283. // message.warning('置顶请输入数字!')
  284. // return false
  285. // };
  286. // }
  287. this.setState({
  288. loading: true
  289. });
  290. $.ajax({
  291. method: "post",
  292. dataType: "json",
  293. crossDomain: false,
  294. url: globalConfig.context + (this.state.RowData.id ? '/api/admin/news/update' : '/api/admin/news/add'),
  295. data: {
  296. id: this.state.RowData.id || null, //主键,如果不填主键则为新增记录,填主键则为更新
  297. title: this.state.RowData.title,
  298. auditStatus:0,
  299. titleImg: this.state.RowData.titleImg,
  300. author: this.state.RowData.author,
  301. type: this.state.callnubs,
  302. hot: this.state.RowData.hot || 0,
  303. source: this.state.RowData.source,
  304. sourceUrl: this.state.RowData.sourceUrl,
  305. summary: this.state.RowData.summary,
  306. releaseStatus: this.state.RowData.releaseStatus,
  307. content: this.state.RowData.content,
  308. createTimeFormattedDate: this.state.RowData.createTimeFormattedDate,
  309. provinceId: this.state.RowData.provinceId,
  310. topNumber:this.state.topNumber,
  311. hotspot :this.state.hotspot
  312. },
  313. success: function (data) {
  314. if (data.error && data.error.length) {
  315. message.warning(data.error[0].message);
  316. } else {
  317. message.success('保存成功!');
  318. this.setState({ visible: false });
  319. this.loadData(this.state.ispage,this.state.callnub);
  320. };
  321. }.bind(this),
  322. }).always(function () {
  323. this.setState({
  324. loading: false
  325. });
  326. }.bind(this));
  327. },
  328. submits() {
  329. if (!this.state.RowData.title) {
  330. message.warning('必须填写一个标题!');
  331. return;
  332. };
  333. if (!this.state.RowData.createTimeFormattedDate) {
  334. message.warning('必须选择一个发布时间!');
  335. return;
  336. };
  337. if (!this.state.RowData.author) {
  338. message.warning('必须填写一个作者!');
  339. return;
  340. };
  341. this.setState({
  342. loading: true
  343. });
  344. $.ajax({
  345. method: "post",
  346. dataType: "json",
  347. crossDomain: false,
  348. url: globalConfig.context + (this.state.RowData.id ? '/api/admin/news/update' : '/api/admin/news/add'),
  349. data: {
  350. id: this.state.RowData.id || null, //主键,如果不填主键则为新增记录,填主键则为更新
  351. title: this.state.RowData.title,
  352. auditStatus:1,
  353. titleImg: this.state.RowData.titleImg,
  354. author: this.state.RowData.author,
  355. type: this.state.callnubs,
  356. hot: this.state.RowData.hot || 0,
  357. source: this.state.RowData.source,
  358. sourceUrl: this.state.RowData.sourceUrl,
  359. summary: this.state.RowData.summary,
  360. releaseStatus: this.state.RowData.releaseStatus,
  361. content: this.state.RowData.content,
  362. createTimeFormattedDate: this.state.RowData.createTimeFormattedDate,
  363. provinceId: this.state.RowData.provinceId,
  364. },
  365. success: function (data) {
  366. if (data.error && data.error.length) {
  367. message.warning(data.error[0].message);
  368. } else {
  369. message.success('保存成功!');
  370. this.setState({ visible: false });
  371. this.loadData(this.state.ispage,this.state.callnub);
  372. };
  373. }.bind(this),
  374. }).always(function () {
  375. this.setState({
  376. loading: false
  377. });
  378. }.bind(this));
  379. },
  380. delectRow() {
  381. let deletedIds = [];
  382. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  383. let rowItem = this.state.selectedRows[idx];
  384. if (rowItem.id) {
  385. deletedIds.push(rowItem.id)
  386. };
  387. };
  388. this.setState({
  389. selectedRowKeys: [],
  390. loading: deletedIds.length > 0
  391. });
  392. $.ajax({
  393. method: "POST",
  394. dataType: "json",
  395. crossDomain: false,
  396. url: globalConfig.context + "/api/admin/news/delete",
  397. data: {
  398. ids: deletedIds
  399. }
  400. }).done(function (data) {
  401. if (data.error && data.error.length) {
  402. message.warning(data.error[0].message);
  403. } else {
  404. message.success('删除成功!');
  405. };
  406. this.setState({
  407. loading: false,
  408. });
  409. this.loadData(this.state.ispage,this.state.callnub);
  410. }.bind(this));
  411. },
  412. reset() {
  413. this.state.searchTitle = undefined;
  414. this.state.searchAuthor = undefined;
  415. this.state.startDate = undefined;
  416. this.state.endDate = undefined;
  417. this.state.searchSource = undefined;
  418. this.state.searchHot = undefined;
  419. this.loadData(1,this.state.callnub);
  420. },
  421. resets() {
  422. this.state.searchTitle = undefined;
  423. this.state.searchAuthor = undefined;
  424. this.state.startDate = undefined;
  425. this.state.endDate = undefined;
  426. this.state.searchSource = undefined;
  427. this.state.searchHot = undefined;
  428. },
  429. cleanCache(sign) {
  430. this.setState({
  431. loading: true
  432. });
  433. $.ajax({
  434. method: "post",
  435. dataType: "json",
  436. crossDomain: false,
  437. url: globalConfig.context + '/api/admin/news/cleanCache',
  438. data: {
  439. 'cacheKey': sign
  440. },
  441. success: function (data) {
  442. if (data.error && data.error.length) {
  443. message.warning(data.error[0].message);
  444. } else {
  445. message.success('清除缓存成功!');
  446. };
  447. }.bind(this),
  448. }).always(function () {
  449. this.setState({
  450. loading: false
  451. });
  452. }.bind(this));
  453. },
  454. render(){
  455. const rowSelection = {
  456. selectedRowKeys: this.state.selectedRowKeys,
  457. onChange: (selectedRowKeys, selectedRows) => {
  458. this.setState({
  459. selectedRows: selectedRows.slice(-1),
  460. selectedRowKeys: selectedRowKeys.slice(-1)
  461. });
  462. }
  463. };
  464. const hasSelected = this.state.selectedRowKeys.length > 0;
  465. return(
  466. <div className="admin-content" >
  467. <div className="admin-content-search">
  468. <Button type="primary" style={{ float: 'right' }}
  469. onClick={() => { this.setState({ RowData: {}, visible: true ,topNumber :'',hotspot :1}) }}>
  470. 添加<Icon type="plus" />
  471. </Button>
  472. <Input placeholder="标题" style={{ width: 200 ,marginBottom:'10px',marginRight:'10px'}}
  473. value={this.state.searchTitle}
  474. onChange={(e) => { this.setState({ searchTitle: e.target.value }); }} />
  475. <Input placeholder="作者" style={{ width: 100 ,marginRight:'10px'}}
  476. value={this.state.searchAuthor}
  477. onChange={(e) => { this.setState({ searchAuthor: e.target.value }); }} />
  478. <Input placeholder="来源" style={{ width: 100 ,marginRight:'10px'}}
  479. value={this.state.searchSource}
  480. onChange={(e) => { this.setState({ searchSource: e.target.value }); }} />
  481. {this.props.newsType == 2 || this.props.newsType == 3 ? <Select placeholder="显示在首页"
  482. style={{ width: 100,marginRight:'10px' }}
  483. value={this.state.searchHot}
  484. onChange={(e) => { this.setState({ searchHot: e }) }}>
  485. <Select.Option value="0" >不显示</Select.Option>
  486. <Select.Option value="1" >显示</Select.Option>
  487. </Select> : <span></span>}
  488. <span style={{marginRight:'10px'}}>发布时间</span>
  489. <DatePicker style={{ width: 110,marginRight:'10px' }}
  490. format="YYYY-MM-DD"
  491. placeholder="选择开始时间"
  492. value={this.state.startDate ? moment(this.state.startDate, "YYYY-MM-DD") : undefined}
  493. onChange={(t, str) => {
  494. this.setState({ startDate: str });
  495. }} />
  496. <span style={{marginRight:'10px'}}>到</span>
  497. <DatePicker style={{ width: 110 ,marginRight:'10px'}}
  498. format="YYYY-MM-DD"
  499. placeholder="选择结束时间"
  500. value={this.state.endDate ? moment(this.state.endDate, "YYYY-MM-DD") : undefined}
  501. onChange={(t, str) => {
  502. this.setState({ endDate: str });
  503. }} />
  504. <Button type="primary" onClick={() => { this.loadData(1,this.state.callnub) }} style={{marginRight:'10px'}}>搜索</Button>
  505. <Button onClick={this.reset} style={{marginRight:'10px'}}>重置</Button>
  506. <Button type='danger' disabled={!hasSelected} onClick={this.delectRow} style={{marginRight:'10px'}}>
  507. 删除<Icon type="minus" />
  508. </Button>
  509. <Button type="primary" onClick={() => { this.cleanCache('news_list_cache_key'); }}>清除策源地缓存</Button>
  510. <Button type="primary" onClick={() => { this.cleanCache('news_portal_list_cache_key'); }}>清除列表页缓存</Button>
  511. <Button type="primary" onClick={() => { this.cleanCache('news_index_list_cache_key'); }}>清除首页缓存</Button>
  512. </div>
  513. <div className="clearfix" style={{marginLeft:'20px'}}>
  514. <Tabs onChange={this.callback} type="card" activeKey={this.state.callnub} style={{paddingLeft:'15px',paddingRight:'15px',marginRight:'20px'}}>
  515. <TabPane tab="科技快讯" key="1" ></TabPane>
  516. <TabPane tab="交易问题" key="2"></TabPane>
  517. <TabPane tab="技淘动态" key="3"></TabPane>
  518. <TabPane tab="国家政策" key="4"></TabPane>
  519. <TabPane tab="地方政策" key="5"></TabPane>
  520. </Tabs>
  521. </div>
  522. <Spin spinning={this.state.loading}>
  523. <Table size="middle" className="no-all-select" columns={this.state.columns}
  524. dataSource={this.state.tableData}
  525. pagination={this.state.pagination}
  526. rowSelection={rowSelection}
  527. style={{
  528. cursor: 'pointer',
  529. }}
  530. onRowClick={this.tableRowClick} />
  531. </Spin>
  532. <Modal title="新闻详情" width={1000} className="news-modal"
  533. visible={this.state.visible}
  534. maskClosable={false}
  535. footer={null}
  536. afterClose={() => { this.state.RowData = {}; }}
  537. onCancel={() => { this.setState({ visible: false }) }} >
  538. <Spin spinning={this.state.loading}>
  539. <div className="clearfix">
  540. <div className="modal-box">
  541. <span className="modal-box-title">新闻标题</span>
  542. <div className="modal-box-detail">
  543. <Input value={this.state.RowData.title}
  544. onChange={(e) => {
  545. this.state.RowData.title = e.target.value;
  546. this.setState({ RowData: this.state.RowData });
  547. }} />
  548. </div>
  549. </div>
  550. <div className="modal-box">
  551. <span className="modal-box-title">简介</span>
  552. <div className="modal-box-detail">
  553. <Input type="textarea" rows={3} value={this.state.RowData.summary}
  554. onChange={(e) => {
  555. this.state.RowData.summary = e.target.value;
  556. this.setState({ RowData: this.state.RowData });
  557. }} />
  558. </div>
  559. </div>
  560. <div className="modal-box">
  561. <span className="modal-box-title">来源</span>
  562. <div className="modal-box-detail">
  563. <Input value={this.state.RowData.source}
  564. onChange={(e) => {
  565. this.state.RowData.source = e.target.value;
  566. this.setState({ RowData: this.state.RowData });
  567. }} />
  568. </div>
  569. </div>
  570. <div className="modal-box">
  571. <span className="modal-box-title">来源链接</span>
  572. <div className="modal-box-detail">
  573. <Input value={this.state.RowData.sourceUrl}
  574. onChange={(e) => {
  575. this.state.RowData.sourceUrl = e.target.value;
  576. this.setState({ RowData: this.state.RowData });
  577. }} />
  578. </div>
  579. </div>
  580. <div className="modal-box">
  581. <span className="modal-box-title">政策类别</span>
  582. <div className="modal-box-detail">
  583. <Select placeholder="政策类别" value={this.state.callnubs} style={{width:'40%'}}
  584. onChange={(e)=>{this.setState({callnubs:e})}}>
  585. {
  586. policy.map(function (item) {
  587. return <Select.Option key={item.value} >{item.key}</Select.Option>
  588. })
  589. }
  590. </Select>
  591. </div>
  592. </div>
  593. <div className="modal-box" style={{ position: 'absolute', right: '0', width: '480px' }}>
  594. <span className="modal-box-title">标题图片</span>
  595. <div className="modal-box-detail clearfix" style={{ width: '360px' }}>
  596. <Avatar sign={'news_title_picture'} visible={this.state.visible}
  597. imageUrl={this.state.RowData.titleImg ? (globalConfig.avatarHost + "/upload" + this.state.RowData.titleImg) : null}
  598. urlData={(url) => { this.state.RowData.titleImg = url }} />
  599. </div>
  600. </div>
  601. </div>
  602. <div className="clearfix">
  603. <div className="modal-box news-box">
  604. <span className="modal-box-title">作者</span>
  605. <div className="modal-box-detail">
  606. <Input value={this.state.RowData.author}
  607. onChange={(e) => {
  608. this.state.RowData.author = e.target.value;
  609. this.setState({ RowData: this.state.RowData });
  610. }} />
  611. </div>
  612. </div>
  613. <div className="modal-box news-box">
  614. <span className="modal-box-title">发布时间</span>
  615. <div className="modal-box-detail">
  616. <DatePicker style={{ width: '120px' }}
  617. format="YYYY-MM-DD"
  618. placeholder="选择发布时间"
  619. value={this.state.RowData.createTimeFormattedDate ? moment(this.state.RowData.createTimeFormattedDate, "YYYY-MM-DD") : undefined}
  620. onChange={(t, str) => {
  621. this.state.RowData.createTimeFormattedDate = str;
  622. this.setState({ RowData: this.state.RowData});
  623. }} />
  624. </div>
  625. </div>
  626. {this.props.newsType == 2 || this.props.newsType == 3 ? <div className="modal-box news-box">
  627. <span className="modal-box-title">发布在首页</span>
  628. <div className="modal-box-detail">
  629. <Radio.Group value={this.state.RowData.hot} onChange={(e) => {
  630. this.state.RowData.hot = e.target.value;
  631. this.setState({ RowData: this.state.RowData });
  632. }} >
  633. <Radio value={0}>否</Radio>
  634. <Radio value={1}>是</Radio>
  635. </Radio.Group>
  636. </div>
  637. </div> : <div></div>}
  638. </div>
  639. <div className="modal-box">
  640. <span className="modal-box-title">选择省份</span>
  641. <select value={this.state.RowData.provinceId} onChange={(e) => {
  642. this.state.RowData.provinceId = e.target.value;
  643. this.setState({RowData: this.state.RowData});
  644. }} className="provin">
  645. {
  646. this.state.list.map(function(name){
  647. return (
  648. <option value={name.id} key={name.id} >{name.name}</option>
  649. )
  650. })
  651. }
  652. </select>
  653. </div>
  654. <div className="clearfix">
  655. <div className="modal-box news-box">
  656. <span className="modal-box-title">置顶序号:</span>
  657. <div className="modal-box-detail">
  658. <Input value={this.state.topNumber } placeholder="请输入数字"
  659. onChange={(e) => {
  660. this.setState({ topNumber:e.target.value});
  661. }} />
  662. </div>
  663. </div>
  664. <div className="modal-box news-box">
  665. <span className="modal-box-title">热门:</span>
  666. <div className="modal-box-detail">
  667. <Radio.Group value={this.state.hotspot} onChange={(e) => {
  668. this.setState({ hotspot : e.target.value });
  669. }} >
  670. <Radio value={1}>否</Radio>
  671. <Radio value={0}>是</Radio>
  672. </Radio.Group>
  673. </div>
  674. </div>
  675. </div>
  676. <Editors textContent={this.state.RowData.content}
  677. uploadUrl={'/api/admin/news/upload'}
  678. uploadSign={'news_content_picture'}
  679. handleRichText={(value) => { this.state.RowData.content = value; }}
  680. visible={this.state.visible} />
  681. <div className="modal-box">
  682. <Button type="primary" onClick={this.submit}>保存草稿</Button>
  683. <Button type="primary" onClick={this.submits}>提交审核</Button>
  684. <Button type="ghost" onClick={() => { this.setState({ visible: false }) }}>取消</Button>
  685. </div>
  686. </Spin>
  687. </Modal>
  688. </div>
  689. )
  690. }
  691. })
  692. export default Manage;