firmList.jsx 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  1. import React from "react";
  2. import $ from "jquery/src/ajax";
  3. import "react-quill/dist/quill.bubble.css";
  4. import moment from "moment";
  5. import "../authentication/techDemand.less";
  6. import {
  7. Form,
  8. Icon,
  9. Button,
  10. Input,
  11. Select,
  12. Table,
  13. message,
  14. DatePicker,
  15. Modal,
  16. Upload,
  17. Popconfirm,
  18. Cascader,
  19. InputNumber,
  20. Radio,
  21. TimePicker,
  22. Tabs,
  23. Tag,
  24. Row,
  25. Col,
  26. } from "antd";
  27. import { areaSelect, getProvince } from "@/NewDicProvinceList"; //省市区
  28. import {
  29. getGameState,
  30. splitUrl,
  31. getprovince,
  32. getStatuslist,
  33. getLvl,
  34. beforeUploadFile,
  35. getPicPath,
  36. } from "@/tools.js";
  37. import Editors from "@/richTextEditors";
  38. import SpinContainer from "../../SpinContainer"; //富文本编辑器
  39. // 上传文件
  40. const PicturesWall = React.createClass({
  41. getInitialState() {
  42. return {
  43. previewVisible: false,
  44. previewImage: "",
  45. fileList: this.props.pictureUrl,
  46. };
  47. },
  48. getDefaultProps() {
  49. return {
  50. changeClick: this.modifyChange,
  51. };
  52. },
  53. handleCancel() {
  54. this.setState({ previewVisible: false });
  55. },
  56. handlePreview(file) {
  57. this.setState({
  58. previewImage: file.url || file.thumbUrl,
  59. previewVisible: true,
  60. });
  61. },
  62. handleChange(info) {
  63. let fileList = info.fileList;
  64. this.setState({ fileList });
  65. this.props.fileList(fileList);
  66. },
  67. componentWillReceiveProps(nextProps) {
  68. this.state.fileList = nextProps.pictureUrl;
  69. // console.log(nextProps.pictureUrl);
  70. },
  71. render() {
  72. const { previewVisible, previewImage, fileList } = this.state;
  73. // 点击上传
  74. const uploadButton = (
  75. <div>
  76. <Icon type="plus" />
  77. <div className="ant-upload-text">点击上传</div>
  78. </div>
  79. );
  80. return (
  81. //上传组件
  82. <div style={{ display: "inline-block" }}>
  83. <Upload
  84. beforeUpload={beforeUploadFile}
  85. // action={globalConfig.context + "/api/admin/militaryEnterprises/uploadPicture"}
  86. action={globalConfig.context + "/api/admin/news/uploadFile"}
  87. data={{ sign: "enterprises_pucture" }}
  88. listType="picture-card"
  89. fileList={fileList}
  90. onPreview={this.handlePreview}
  91. onChange={this.handleChange}
  92. >
  93. {fileList && fileList.length >= 1 ? null : uploadButton}
  94. </Upload>
  95. <Modal
  96. maskClosable={false}
  97. visible={previewVisible}
  98. footer={null}
  99. onCancel={(e) => {
  100. this.setState({ previewVisible: false });
  101. }}
  102. >
  103. <img alt="" style={{ width: "100%" }} src={previewImage} />
  104. </Modal>
  105. </div>
  106. );
  107. },
  108. });
  109. //主体
  110. const FirmList = Form.create()(
  111. React.createClass({
  112. // 初始化数据
  113. loadData(pageNo) {
  114. this.state.data = [];
  115. this.setState({
  116. loading: true,
  117. page: pageNo,
  118. });
  119. //发送请求
  120. $.ajax({
  121. method: "get",
  122. dataType: "json",
  123. crossDomain: false,
  124. url: globalConfig.context + "/api/admin/news/listNews",
  125. data: {
  126. pageNo: pageNo || this.state.pagination.current || 1,
  127. pageSize: this.state.pagination.pageSize,
  128. title: this.state.titleSearch,
  129. type: this.state.typeSearch,
  130. },
  131. success: function (data) {
  132. let theArr = [];
  133. if (!data.data || !data.data.list) {
  134. if (data.error && data.error.length) {
  135. message.warning(data.error[0].message);
  136. }
  137. } else {
  138. for (let i = 0; i < data.data.list.length; i++) {
  139. let thisdata = data.data.list[i];
  140. theArr.push({
  141. key: i + 1,
  142. id: thisdata.id,
  143. title: thisdata.title,
  144. publisher: thisdata.publisher,
  145. type: thisdata.type,
  146. pictureUrl: thisdata.pictureUrl,
  147. sort: thisdata.sort,
  148. releaseStatus: thisdata.releaseStatus,
  149. releaseTimeConvert: thisdata.releaseTimeConvert,
  150. status: thisdata.status,
  151. content: thisdata.content,
  152. });
  153. }
  154. this.state.pagination.current = data.data.pageNo;
  155. this.state.pagination.total = data.data.totalCount;
  156. }
  157. this.setState({
  158. dataSource: theArr,
  159. pagination: this.state.pagination,
  160. });
  161. }.bind(this),
  162. }).always(
  163. function () {
  164. this.setState({
  165. loading: false,
  166. });
  167. }.bind(this)
  168. );
  169. },
  170. //声明状态
  171. getInitialState() {
  172. return {
  173. pictureUrl: [],
  174. loading: false,
  175. flag: true,
  176. editorState: null,
  177. activeKey: "1",
  178. timesArr: [],
  179. ProvinceCity: [],
  180. ProvinceCityC: [],
  181. totalData: {
  182. mark: false,
  183. },
  184. imgWidth: "width: 200px",
  185. logoUrl: [],
  186. pagination: {
  187. defaultCurrent: 1,
  188. defaultPageSize: 10,
  189. showQuickJumper: true,
  190. pageSize: 10,
  191. onChange: function (page) {
  192. this.loadData(page);
  193. this.setState({
  194. selectedRowKeys: [],
  195. });
  196. }.bind(this),
  197. showTotal: function (total) {
  198. return "共" + total + "条数据";
  199. },
  200. },
  201. //数据类型
  202. columns: [
  203. {
  204. title: "序号",
  205. dataIndex: "key",
  206. key: "key",
  207. },
  208. {
  209. title: "新闻分类",
  210. dataIndex: "type",
  211. key: "type",
  212. render: (text) => {
  213. if (text == 0) {
  214. return "官方公告";
  215. } else if (text == 1) {
  216. return "政策解读";
  217. } else if (text == 2) {
  218. return "高新技术企业";
  219. } else if (text == 3) {
  220. return "军工三证";
  221. }
  222. },
  223. },
  224. {
  225. title: "新闻标题",
  226. dataIndex: "title",
  227. key: "title",
  228. render: (text) => {
  229. return text.length >= 8 ? text.substring(0, 8) + "..." : text;
  230. },
  231. },
  232. {
  233. title: "排序",
  234. dataIndex: "sort",
  235. key: "sort",
  236. },
  237. {
  238. title: "是否首页",
  239. dataIndex: "status",
  240. key: "status",
  241. render: (s) => {
  242. return s ? (
  243. <Tag color="#87d068">是</Tag>
  244. ) : (
  245. <Tag color="#f50">否</Tag>
  246. );
  247. },
  248. },
  249. {
  250. title: "新闻缩率图",
  251. dataIndex: "pictureUrl",
  252. key: "pictureUrl",
  253. render: (url) => {
  254. let path = getPicPath(globalConfig.avatarUploadHost, url);
  255. return (
  256. <div style={{ textAlign: "center" }}>
  257. <img src={path} style={{ width: "100px", height: 50 }} />
  258. <Button
  259. className="buttonimg"
  260. style={{ marginLeft: 10 }}
  261. onClick={(e) => {
  262. e.stopPropagation();
  263. this.maximg(path);
  264. }}
  265. >
  266. 查看大图
  267. </Button>
  268. </div>
  269. );
  270. },
  271. },
  272. {
  273. title: "发布状态",
  274. dataIndex: "releaseStatus",
  275. key: "releaseStatus",
  276. render: (text) => {
  277. return text ? "是" : "否";
  278. },
  279. },
  280. // {
  281. // title: "置顶",
  282. // dataIndex: "topNumber",
  283. // key: "topNumber",
  284. // render: text => {
  285. // return text ? "否" : "是";
  286. // }
  287. // },
  288. {
  289. title: "操作",
  290. dataIndex: "operate",
  291. key: "operate",
  292. render: (text, record, index) => {
  293. return (
  294. <div>
  295. <Button
  296. type="primary"
  297. style={{ marginLeft: "10px" }}
  298. onClick={() => {
  299. this.setState({
  300. flag: true,
  301. });
  302. this.edit(record);
  303. }}
  304. >
  305. 编辑
  306. </Button>
  307. <Popconfirm
  308. title="您确定删除该新闻吗?"
  309. onConfirm={() => this.confirm(record.id)}
  310. onCancel={this.cancel}
  311. okText="是"
  312. cancelText="否"
  313. >
  314. <Button
  315. type="danger"
  316. style={{ marginLeft: "10px" }}
  317. onClick={(e) => {
  318. e.stopPropagation();
  319. }}
  320. >
  321. 删除
  322. </Button>
  323. </Popconfirm>
  324. <Button
  325. type="primary"
  326. style={{ marginLeft: "10px" }}
  327. onClick={(e) => {
  328. e.stopPropagation();
  329. if (record.status) {
  330. this.toTop(record, 0);
  331. } else {
  332. this.toTop(record, 1);
  333. }
  334. }}
  335. >
  336. {record.status ? "从首页撤下" : "推荐至首页"}
  337. </Button>
  338. </div>
  339. );
  340. },
  341. },
  342. {
  343. title: "发布时间",
  344. dataIndex: "releaseTimeConvert",
  345. key: "releaseTimeConvert",
  346. },
  347. ],
  348. //数据列表
  349. dataSource: [],
  350. };
  351. },
  352. // 新增新闻按钮
  353. add() {
  354. this.setState({
  355. editvisible: true,
  356. flag: false,
  357. });
  358. },
  359. // 推荐置顶
  360. toTop(record, num) {
  361. $.ajax({
  362. method: "post",
  363. dataType: "json",
  364. crossDomain: false,
  365. url: globalConfig.context + "/api/admin/news/updateNews",
  366. data: {
  367. id: record.id,
  368. status: num,
  369. },
  370. success: function (data) {
  371. let theArr = [];
  372. if (data.error && data.error.length) {
  373. message.warning(data.error[0].message);
  374. } else {
  375. this.loadData();
  376. }
  377. }.bind(this),
  378. }).always(
  379. function () {
  380. this.setState({
  381. loading: false,
  382. });
  383. }.bind(this)
  384. );
  385. },
  386. //编辑按钮操作
  387. tableRowClick(record) {
  388. this.setState({
  389. flag: true,
  390. editvisible: true,
  391. });
  392. this.edit(record);
  393. },
  394. edit(record, index) {
  395. this.setState({
  396. editvisible: true,
  397. loading: true,
  398. });
  399. $.ajax({
  400. method: "get",
  401. dataType: "json",
  402. crossDomain: false,
  403. url: globalConfig.context + "/api/admin/news/selectNews",
  404. data: {
  405. id: record.id,
  406. },
  407. success: function (data) {
  408. let theArr = [];
  409. if (data.error && data.error.length) {
  410. message.warning(data.error[0].message);
  411. } else {
  412. let thisdata = data.data;
  413. this.setState({
  414. id: thisdata.id,
  415. title: thisdata.title,
  416. publisher: thisdata.publisher,
  417. type: thisdata.type,
  418. sort: thisdata.sort,
  419. keywords: thisdata.keywords,
  420. editorcontext: thisdata.content,
  421. releaseStatus: thisdata.releaseStatus,
  422. time: thisdata.releaseTimeConvert
  423. ? thisdata.releaseTimeConvert
  424. : thisdata.createTimeConvert,
  425. });
  426. window.setTimeout(() => {
  427. this.setState({
  428. pictureUrl: thisdata.pictureUrl ? splitUrl(thisdata.pictureUrl, ",", globalConfig.avatarUploadHost) : [],
  429. })
  430. }, 100);
  431. }
  432. }.bind(this),
  433. }).always(
  434. function () {
  435. this.setState({
  436. loading: false,
  437. });
  438. }.bind(this)
  439. );
  440. },
  441. getOrgCodeUrl(e) {
  442. this.setState({ pictureUrl: e });
  443. },
  444. // 新增新闻
  445. addNew(flag) {
  446. let theorgCodeUrl = [];
  447. if (this.state.pictureUrl.length) {
  448. let picArr = [];
  449. this.state.pictureUrl.map(function (item) {
  450. if (
  451. item.response &&
  452. item.response.data &&
  453. item.response.data.length
  454. ) {
  455. picArr.push(item.response.data);
  456. }
  457. });
  458. theorgCodeUrl = picArr.join(",");
  459. } else {
  460. message.warn("请上传新闻大图")
  461. return
  462. }
  463. this.setState({
  464. loading: true,
  465. });
  466. if (this.state.flag) {
  467. $.ajax({
  468. method: "post",
  469. dataType: "json",
  470. crossDomain: false,
  471. url: globalConfig.context + "/api/admin/news/updateNews",
  472. data: {
  473. id: this.state.id,
  474. title: this.state.title,
  475. publisher: this.state.publisher,
  476. type: this.state.type,
  477. pictureUrl: theorgCodeUrl,
  478. sort: this.state.sort,
  479. content: this.state.editorcontext,
  480. status: this.state.status,
  481. releaseTimes: this.state.time,
  482. releaseStatus: flag,
  483. keywords: this.state.keywords,
  484. },
  485. success: function (data) {
  486. this.setState({
  487. loading: false,
  488. });
  489. let theArr = [];
  490. if (data.error && data.error.length) {
  491. message.warning(data.error[0].message);
  492. } else {
  493. this.loadData();
  494. this.handleCancelEdit();
  495. }
  496. }.bind(this),
  497. }).always(
  498. function () {
  499. this.setState({
  500. loading: false,
  501. });
  502. }.bind(this)
  503. );
  504. } else {
  505. $.ajax({
  506. method: "post",
  507. dataType: "json",
  508. crossDomain: false,
  509. url: globalConfig.context + "/api/admin/news/addNews",
  510. data: {
  511. title: this.state.title,
  512. publisher: this.state.publisher,
  513. type: this.state.type,
  514. pictureUrl: theorgCodeUrl,
  515. sort: this.state.sort,
  516. content: this.state.editorcontext,
  517. releaseStatus: flag,
  518. status: 0,
  519. releaseTimes: this.state.time,
  520. keywords: this.state.keywords,
  521. },
  522. success: function (data) {
  523. this.setState({
  524. loading: false,
  525. });
  526. let theArr = [];
  527. if (data.error && data.error.length) {
  528. message.warning(data.error[0].message);
  529. } else {
  530. this.loadData();
  531. this.handleCancelEdit();
  532. }
  533. }.bind(this),
  534. }).always(
  535. function () {
  536. this.setState({
  537. loading: false,
  538. });
  539. }.bind(this)
  540. );
  541. }
  542. },
  543. //表单内容改变时候触发
  544. change(key, e, f) {
  545. if (f === undefined) {
  546. this.state.totalData[key] = e;
  547. this.setState({
  548. totalData: this.state.totalData,
  549. });
  550. } else if (typeof f === "function") {
  551. this.state.totalData[key] = e;
  552. this.setState(
  553. {
  554. totalData: this.state.totalData,
  555. },
  556. f
  557. );
  558. }
  559. },
  560. // 关闭模态框
  561. handleCancelEdit() {
  562. this.setState({
  563. editvisible: false,
  564. });
  565. this.addReset();
  566. },
  567. //点击大图
  568. maximg(url) {
  569. this.setState({
  570. imgeditvisible: true,
  571. maximg: url,
  572. });
  573. },
  574. componentWillMount() {
  575. this.loadData();
  576. },
  577. //确认要删除吗
  578. confirm(id) {
  579. $.ajax({
  580. method: "post",
  581. dataType: "json",
  582. crossDomain: false,
  583. url: globalConfig.context + "/api/admin/news/deleteNews",
  584. data: {
  585. id,
  586. },
  587. success: function (data) {
  588. let theArr = [];
  589. if (data.error && data.error.length) {
  590. message.warning(data.error[0].message);
  591. } else {
  592. this.loadData();
  593. }
  594. }.bind(this),
  595. }).always(
  596. function () {
  597. this.setState({
  598. loading: false,
  599. });
  600. }.bind(this)
  601. );
  602. },
  603. imghandleCancel() {
  604. this.setState({
  605. imgeditvisible: false,
  606. });
  607. },
  608. //取消删除
  609. cancel() {
  610. console.log("我取消删除了");
  611. },
  612. async submitContent() {
  613. // 在编辑器获得焦点时按下ctrl+s会执行此方法
  614. // 编辑器内容提交到服务端之前,可直接调用editorState.toHTML()来获取HTML格式的内容
  615. const htmlContent = this.state.editorState.toHTML();
  616. const result = await saveEditorContent(htmlContent);
  617. },
  618. //新增框的清零
  619. addReset() {
  620. this.setState({
  621. pictureUrl: [],
  622. title: undefined,
  623. publisher: undefined,
  624. type: undefined,
  625. sort: undefined,
  626. editorcontext: "",
  627. time: undefined,
  628. keywords: "",
  629. });
  630. },
  631. //搜索部分的清零
  632. reset() {
  633. this.state.titleSearch = undefined;
  634. this.state.typeSearch = undefined;
  635. this.loadData(1);
  636. },
  637. render() {
  638. const FormItem = Form.Item;
  639. const rowSelection = {
  640. selectedRowKeys: this.state.selectedRowKeys,
  641. onChange: (selectedRowKeys, selectedRows) => {
  642. this.setState({
  643. selectedRows: selectedRows.slice(-1),
  644. selectedRowKeys: selectedRowKeys.slice(-1),
  645. });
  646. },
  647. };
  648. let data = this.state.totalData;
  649. const { TextArea } = Input; //文本域
  650. const { TabPane } = Tabs; //标签页
  651. const { MonthPicker, RangePicker, WeekPicker } = DatePicker; //日期输入框
  652. const { editorState } = this.state;
  653. return (
  654. <div className="user-content">
  655. <div className="content-title">
  656. <span>新闻列表</span>
  657. <div className="user-search">
  658. <Input
  659. placeholder="请输入新闻标题"
  660. style={{
  661. width: "150px",
  662. marginRight: "10px",
  663. marginBottom: "10px",
  664. }}
  665. value={this.state.titleSearch}
  666. onChange={(e) => {
  667. this.setState({ titleSearch: e.target.value });
  668. }}
  669. />
  670. <Select
  671. style={{ width: 120 }}
  672. placeholder="请选择新闻类型"
  673. value={
  674. this.state.typeSearch == 1
  675. ? "政策解读"
  676. : this.state.typeSearch == 0
  677. ? "官方公告"
  678. : this.state.typeSearch == 2
  679. ? "高新技术企业"
  680. : this.state.typeSearch == 3
  681. ? "军工三证"
  682. : []
  683. }
  684. onChange={(e) => {
  685. this.setState({
  686. typeSearch: e,
  687. });
  688. }}
  689. >
  690. <Option value="0">官方公告</Option>
  691. <Option value="1">政策解读</Option>
  692. <Option value="2">高新技术企业</Option>
  693. <Option value="3">军工三证</Option>
  694. </Select>
  695. <Button
  696. type="primary"
  697. onClick={(e) => {
  698. this.loadData(1);
  699. }}
  700. style={{ marginRight: "10px" }}
  701. >
  702. 搜索
  703. </Button>
  704. <Button onClick={this.reset} style={{ marginRight: "10px" }}>
  705. 重置
  706. </Button>
  707. <Button
  708. type="primary"
  709. onClick={this.add}
  710. style={{ marginLeft: "100px" }}
  711. >
  712. 新增新闻
  713. </Button>
  714. </div>
  715. {/* 新闻表单 */}
  716. <div className="patent-table">
  717. <SpinContainer spinning={this.state.loading}>
  718. <Table
  719. columns={this.state.columns}
  720. dataSource={this.state.dataSource}
  721. pagination={this.state.pagination}
  722. onRowClick={this.tableRowClick}
  723. bordered
  724. size="small"
  725. ellipsis="true"
  726. />
  727. </SpinContainer>
  728. </div>
  729. </div>
  730. {/* 模块框 */}
  731. <div className="patent-desc">
  732. <Modal
  733. className="customeDetails"
  734. title={this.state.flag ? "新闻详情" : "新增新闻"}
  735. width="1000px"
  736. onCancel={this.handleCancelEdit}
  737. visible={this.state.editvisible}
  738. footer=""
  739. >
  740. <Form
  741. layout="horizontal"
  742. onSubmit={this.edithandleSubmit}
  743. id="demand-form"
  744. >
  745. <SpinContainer spinning={this.state.loading}>
  746. <div className="clearfix">
  747. <Row>
  748. <FormItem
  749. className="half-item"
  750. labelCol={{ span: 8 }}
  751. wrapperCol={{ span: 12 }}
  752. label="新闻标题"
  753. >
  754. <Input
  755. placeholder="请输入新闻标题"
  756. value={this.state.title}
  757. onChange={(e) => {
  758. this.setState({
  759. title: e.target.value,
  760. });
  761. }}
  762. style={{ width: "240px" }}
  763. />
  764. </FormItem>
  765. <FormItem
  766. className="half-item"
  767. labelCol={{ span: 8 }}
  768. wrapperCol={{ span: 12 }}
  769. label="新闻类别"
  770. >
  771. <Select
  772. style={{ width: 120 }}
  773. placeholder="请选择新闻类型"
  774. value={
  775. this.state.type == 1
  776. ? "政策解读"
  777. : this.state.type == 0
  778. ? "官方公告"
  779. : this.state.type == 2
  780. ? "高新技术企业"
  781. : this.state.type == 3
  782. ? "军工三证"
  783. : []
  784. }
  785. onChange={(e) => {
  786. this.setState({
  787. type: e,
  788. });
  789. }}
  790. >
  791. <Option value="0">官方公告</Option>
  792. <Option value="1">政策解读</Option>
  793. <Option value="2">高新技术企业</Option>
  794. <Option value="3">军工三证</Option>
  795. </Select>
  796. </FormItem>
  797. </Row>
  798. <Row>
  799. <FormItem
  800. className="half-item"
  801. labelCol={{ span: 8 }}
  802. wrapperCol={{ span: 12 }}
  803. label="新闻发布人"
  804. >
  805. <Input
  806. placeholder="请输入新闻发布人"
  807. value={this.state.publisher}
  808. onChange={(e) => {
  809. this.setState({
  810. publisher: e.target.value,
  811. });
  812. }}
  813. style={{ width: "240px" }}
  814. />
  815. </FormItem>
  816. <FormItem
  817. className="half-item"
  818. labelCol={{ span: 8 }}
  819. wrapperCol={{ span: 12 }}
  820. label="发布时间"
  821. >
  822. <DatePicker
  823. placeholder="请输入发布时间"
  824. format="YYYY-MM-DD HH:mm:ss"
  825. showTime
  826. value={
  827. this.state.time ? moment(this.state.time) : moment()
  828. }
  829. onChange={(e, f) => {
  830. this.setState({ time: f });
  831. // console.log(e, f);
  832. }}
  833. style={{ width: "240px" }}
  834. />
  835. </FormItem>
  836. </Row>
  837. <Row>
  838. <FormItem
  839. className="half-item"
  840. labelCol={{ span: 8 }}
  841. wrapperCol={{ span: 12 }}
  842. label="排序"
  843. >
  844. <Input
  845. placeholder="请输入排序"
  846. value={this.state.sort}
  847. onChange={(e) => {
  848. this.setState({
  849. sort: e.target.value,
  850. });
  851. }}
  852. style={{ width: "240px" }}
  853. />
  854. </FormItem>
  855. </Row>
  856. <Row>
  857. <FormItem
  858. className="half-item"
  859. labelCol={{ span: 8 }}
  860. wrapperCol={{ span: 12 }}
  861. label="关键词设置"
  862. >
  863. <TextArea
  864. placeholder="请输入关键词设置"
  865. value={this.state.keywords}
  866. onChange={(e) => {
  867. this.setState({
  868. keywords: e.target.value,
  869. });
  870. }}
  871. style={{ width: "240px" }}
  872. />
  873. </FormItem>
  874. <span
  875. style={{
  876. top: "28px",
  877. position: "relative",
  878. left: "-79px",
  879. }}
  880. >
  881. 设置多个关键词,请用英文,隔开
  882. </span>
  883. </Row>
  884. </div>
  885. <div className="clearfix">
  886. <FormItem
  887. labelCol={{ span: 4 }}
  888. wrapperCol={{ span: 18 }}
  889. onCancel={this.handleCancel}
  890. label="新闻大图"
  891. >
  892. <PicturesWall
  893. fileList={this.getOrgCodeUrl}
  894. pictureUrl={this.state.pictureUrl}
  895. />
  896. <p>建议尺寸:285X200 图片建议:要清晰。</p>
  897. </FormItem>
  898. </div>
  899. <div className="clearfix">
  900. <FormItem
  901. labelCol={{ span: 4 }}
  902. wrapperCol={{ span: 18 }}
  903. label="企业简介0"
  904. >
  905. <Editors
  906. textContent={this.state.editorcontext}
  907. uploadUrl={"/api/admin/news/uploadFile"}
  908. globalConfig={globalConfig.uploadPath}
  909. placeholder="业务项目客户基本条件"
  910. handleRichText={(value) => {
  911. let imgReg = /<img.*?(?:>|\/>)/gi //匹配图片中的img标签
  912. let srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i // 匹配图片中的src
  913. let arr = value.match(imgReg) || [] //筛选出所有的img
  914. let srcArr = []
  915. for (let i = 0; i < arr.length; i++) {
  916. let src = arr[i].match(srcReg)
  917. // 获取图片地址
  918. srcArr.push(src[1])
  919. }
  920. this.setState({
  921. editorcontext: value,
  922. });
  923. console.log("")
  924. if (srcArr.length > 0) {
  925. // 复制过来的图片可能带https前缀
  926. if (srcArr[0].indexOf("http") != -1) {
  927. return
  928. }
  929. let purl = srcArr[0].replace(globalConfig.avatarUploadHost, "")
  930. if (splitUrl(purl, ",", globalConfig.avatarUploadHost) == this.state.pictureUrl) {
  931. return
  932. }
  933. this.setState({
  934. pictureUrl: purl ? splitUrl(purl, ",", globalConfig.avatarUploadHost) : []
  935. })
  936. }
  937. }}
  938. />
  939. </FormItem>
  940. </div>
  941. <div className="clearfix">
  942. <Button
  943. type="primary"
  944. size="large"
  945. onClick={(e) => {
  946. this.addNew(0);
  947. }}
  948. style={{
  949. float: "right",
  950. marginRight: "80px",
  951. marginTop: "20px",
  952. }}
  953. >
  954. 保存
  955. </Button>
  956. <Button
  957. type="primary"
  958. size="large"
  959. onClick={(e) => {
  960. this.addNew(1);
  961. }}
  962. style={{
  963. float: "right",
  964. marginRight: "20px",
  965. marginTop: "20px",
  966. }}
  967. >
  968. 保存并发布
  969. </Button>
  970. </div>
  971. </SpinContainer>
  972. </Form>
  973. </Modal>
  974. <Modal
  975. visible={this.state.imgeditvisible}
  976. onCancel={this.imghandleCancel}
  977. onOk={this.imgOk}
  978. >
  979. <img style={{ width: "100%" }} src={this.state.maximg} />
  980. </Modal>
  981. </div>
  982. </div>
  983. );
  984. },
  985. })
  986. );
  987. export default FirmList;