advertisementList.jsx 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894
  1. import React from "react";
  2. import $ from "jquery/src/ajax";
  3. import "react-quill/dist/quill.bubble.css";
  4. import {companyList, getCompanyName, getCompanyValueArray} from '../../common/configure';
  5. import {
  6. Form,
  7. Icon,
  8. Button,
  9. Input,
  10. Select,
  11. Table,
  12. message,
  13. DatePicker,
  14. Modal,
  15. Upload,
  16. Popconfirm,
  17. Cascader,
  18. InputNumber,
  19. Radio,
  20. TimePicker,
  21. Tabs,
  22. Tag,
  23. Checkbox, Tooltip
  24. } from "antd";
  25. import { areaSelect, getProvince } from "@/NewDicProvinceList"; //省市区
  26. import {
  27. getGameState,
  28. splitUrl,
  29. getprovince,
  30. getStatuslist,
  31. getLvl,
  32. beforeUploadFile,
  33. getPicPath
  34. } from "@/tools.js";
  35. import SpinContainer from "../../SpinContainer";
  36. const { Option } = Select;
  37. const PicturesWall = React.createClass({
  38. getInitialState() {
  39. return {
  40. previewVisible: false,
  41. previewImage: "",
  42. fileList: [],
  43. };
  44. },
  45. getDefaultProps() {
  46. return {
  47. changeClick: this.modifyChange
  48. };
  49. },
  50. handleCancel() {
  51. this.setState({ previewVisible: false });
  52. },
  53. handlePreview(file) {
  54. this.setState({
  55. previewImage: file.url || file.thumbUrl,
  56. previewVisible: true
  57. });
  58. },
  59. handleChange(info) {
  60. let fileList = info.fileList;
  61. this.setState({ fileList });
  62. this.props.fileList(fileList);
  63. },
  64. componentWillReceiveProps(nextProps) {
  65. this.state.fileList = nextProps.pictureUrl;
  66. },
  67. render() {
  68. const { previewVisible, previewImage, fileList } = this.state;
  69. const uploadButton = (
  70. <div>
  71. <Icon type="plus" />
  72. <div className="ant-upload-text">点击上传</div>
  73. </div>
  74. );
  75. return (
  76. <div style={{ display: "inline-block" }}>
  77. <Upload
  78. beforeUpload={beforeUploadFile}
  79. // action={globalConfig.context + "/api/admin/purchase/uploadPicture"}
  80. // url: '//172.16.0.253:8080' + '/api/admin/banners/addBanners',
  81. action={globalConfig.context + "/api/admin/banners/uploadFile"}
  82. data={{ sign: "purchase_picture" }}
  83. listType="picture-card"
  84. fileList={fileList}
  85. onPreview={this.handlePreview}
  86. onChange={this.handleChange}
  87. >
  88. {fileList && fileList.length >= 1 ? null : uploadButton}
  89. </Upload>
  90. <Modal
  91. maskClosable={false}
  92. visible={previewVisible}
  93. footer={null}
  94. onCancel={this.handleCancel}
  95. >
  96. <img alt="" style={{ width: "100%" }} src={previewImage} />
  97. </Modal>
  98. </div>
  99. );
  100. }
  101. });
  102. //主体
  103. const AdvertisementList = Form.create()(
  104. React.createClass({
  105. loadData(pageNo) {
  106. this.state.data = [];
  107. this.setState({
  108. loading: true,
  109. page: pageNo
  110. });
  111. $.ajax({
  112. method: "get",
  113. dataType: "json",
  114. // url: globalConfig.context + '/api/admin/listCases',
  115. url: globalConfig.context + "/api/admin/banners/listBanners",
  116. data: {
  117. pageNo: pageNo || this.state.pagination.current || 1,
  118. pageSize: this.state.pagination.pageSize,
  119. position: this.state.positionSearch,
  120. location:this.state.locationSearch,
  121. },
  122. success: function(data) {
  123. let theArr = [];
  124. if (!data.data || !data.data.list) {
  125. if (data.error && data.error.length) {
  126. message.warning(data.error[0].message);
  127. }
  128. } else {
  129. for (let i = 0; i < data.data.list.length; i++) {
  130. let thisdata = data.data.list[i];
  131. thisdata.key = i + 1;
  132. theArr.push(thisdata);
  133. }
  134. this.state.pagination.current = data.data.pageNo;
  135. this.state.pagination.total = data.data.totalCount;
  136. }
  137. this.setState({
  138. dataSource: theArr,
  139. pagination: this.state.pagination
  140. });
  141. }.bind(this)
  142. }).always(
  143. function() {
  144. this.setState({
  145. loading: false
  146. });
  147. }.bind(this)
  148. );
  149. },
  150. getInitialState() {
  151. return {
  152. loading: false,
  153. flag: true,
  154. imgeditvisible: false,
  155. activeKey: "1",
  156. purchaseImg: [],
  157. maximg: "",
  158. timesArr: [],
  159. locations: [],
  160. indeterminate:false,
  161. pagination: {
  162. defaultCurrent: 1,
  163. defaultPageSize: 10,
  164. showQuickJumper: true,
  165. pageSize: 10,
  166. onChange: function(page) {
  167. this.loadData(page);
  168. this.setState({
  169. selectedRowKeys: []
  170. });
  171. }.bind(this),
  172. showTotal: function(total) {
  173. return "共" + total + "条数据";
  174. }
  175. },
  176. //数据类型
  177. columns: [
  178. {
  179. title: "序号",
  180. dataIndex: "key",
  181. key: "key"
  182. },
  183. {
  184. title: "广告位置",
  185. dataIndex: "position",
  186. key: "position",
  187. render: text => {
  188. if (text == 0) {
  189. return <span>首页</span>;
  190. }else if(text == 1) {
  191. return <span>产品中心</span>;
  192. }else if(text == 2) {
  193. return <span>战略合作</span>;
  194. }else if(text == 3) {
  195. return <span>服务客户</span>;
  196. }else if(text == 4) {
  197. return <span>新闻动态</span>;
  198. }else if(text == 5) {
  199. return <span>关于科德</span>;
  200. }else if(text == 6) {
  201. return <span>联系我们</span>;
  202. }else {
  203. return "未知"
  204. }
  205. }
  206. },
  207. {
  208. title: "广告缩略图",
  209. dataIndex: "bannerUrl",
  210. key: "bannerUrl",
  211. render: url => {
  212. let path = getPicPath(globalConfig.avatarUploadHost, url);
  213. return (
  214. <div style={{ textAlign: "center" }}>
  215. <img src={path} style={{ width: "100px", height: 50 }} />
  216. <Button
  217. className="buttonimg"
  218. style={{ marginLeft: 10 }}
  219. onClick={e => {
  220. this.stopPropagation(e);
  221. this.maximg(path);
  222. }}
  223. >
  224. 查看大图
  225. </Button>
  226. </div>
  227. );
  228. }
  229. },
  230. {
  231. title: "跳转地址",
  232. dataIndex: "jumpUrl",
  233. key: "jumpUrl",
  234. width: 200,
  235. render: r => {
  236. return (
  237. <span style={{
  238. width:200,
  239. overflow: 'hidden',
  240. whiteSpace: 'nowrap',
  241. display: 'block',
  242. textOverflow: 'ellipsis',
  243. }}>{r === 'javascript:;' ? '' : r}</span>
  244. )
  245. }
  246. },
  247. {
  248. title: "公司",
  249. dataIndex: "locations",
  250. key: "locations",
  251. width:150,
  252. render: r => {
  253. let text = '';
  254. r && r.map((v,i)=>(
  255. text += (i === 0 ? '':',')+getCompanyName(v)
  256. ))
  257. return(
  258. <Tooltip placement="top" title={text}>
  259. {
  260. r && r.map((v,i)=>(
  261. i <= 2 ? (i === 0 ? '':',')+getCompanyName(v) : null
  262. ))
  263. }
  264. {
  265. r.length > 3 ? '.....' : null
  266. }
  267. </Tooltip>
  268. )
  269. }
  270. },
  271. {
  272. title: "是否显示",
  273. dataIndex: "display",
  274. key: "display",
  275. render: s => {
  276. return s ? (
  277. <Tag color="#87d068">显示</Tag>
  278. ) : (
  279. <Tag color="#f50">未显示</Tag>
  280. );
  281. }
  282. },
  283. {
  284. title: "排序",
  285. dataIndex: "sort",
  286. key: "sort"
  287. },
  288. {
  289. title: "操作",
  290. dataIndex: "c",
  291. render: (text, record, index) => {
  292. return (
  293. <div>
  294. {
  295. <Button
  296. type="primary"
  297. onClick={event => {
  298. this.stopPropagation(event);
  299. this.tableRowClick(record);
  300. }}
  301. >
  302. 编辑
  303. </Button>
  304. }
  305. {
  306. <Popconfirm
  307. okText="确定"
  308. cancelText="取消"
  309. title="您确定删除?删除后,广告将不再显示"
  310. onConfirm={() => {
  311. this.delete(record.id);
  312. }}
  313. >
  314. <Button
  315. type="danger"
  316. style={{ marginLeft: "10px" }}
  317. onClick={event => {
  318. this.stopPropagation(event);
  319. }}
  320. >
  321. 删除
  322. </Button>
  323. </Popconfirm>
  324. }
  325. {!record.display ? (
  326. <Button
  327. type="primary"
  328. style={{ marginLeft: "10px" }}
  329. onClick={event => {
  330. this.stopPropagation(event);
  331. this.edit(record, "1");
  332. }}
  333. >
  334. 显示
  335. </Button>
  336. ) : (
  337. <Button
  338. type="primary"
  339. style={{ marginLeft: "10px" }}
  340. onClick={event => {
  341. this.stopPropagation(event);
  342. this.edit(record, "0");
  343. }}
  344. >
  345. 隐藏
  346. </Button>
  347. )}
  348. </div>
  349. );
  350. }
  351. }
  352. ],
  353. //数据列表
  354. dataSource: [
  355. ]
  356. };
  357. },
  358. componentWillMount() {
  359. this.loadData();
  360. },
  361. detailes(record) {
  362. this.setState({
  363. loading: true
  364. });
  365. $.ajax({
  366. method: "get",
  367. dataType: "json",
  368. crossDomain: false,
  369. url: globalConfig.context + "/api/admin/banners/selectBanners",
  370. data: {
  371. id: record.id
  372. },
  373. success: function(data) {
  374. let thisdata = data.data;
  375. this.setState({
  376. id: thisdata.id,
  377. title: thisdata.title,
  378. jumpUrl: thisdata.jumpUrl === 'javascript:;' ? undefined : thisdata.jumpUrl,
  379. bannerUrl: thisdata.bannerUrl
  380. ? splitUrl(thisdata.bannerUrl, ",", globalConfig.avatarUploadHost)
  381. : [],
  382. sortNumber: thisdata.sort,
  383. display: thisdata.display,
  384. position: thisdata.position,
  385. locations: thisdata.locations,
  386. checked:thisdata.locations.length === companyList.length,
  387. indeterminate: thisdata.locations.length < companyList.length,
  388. });
  389. }.bind(this)
  390. }).always(
  391. function() {
  392. this.setState({
  393. loading: false
  394. });
  395. }.bind(this)
  396. );
  397. },
  398. //点击大图
  399. maximg(url) {
  400. this.setState({
  401. imgeditvisible: true,
  402. maximg: url
  403. });
  404. },
  405. //删除按钮
  406. delete(id) {
  407. $.ajax({
  408. method: "post",
  409. dataType: "json",
  410. crossDomain: false,
  411. url: globalConfig.context + "/api/admin/banners/deleteBanners",
  412. data: {
  413. id
  414. },
  415. success: function(data) {
  416. this.loadData();
  417. }.bind(this)
  418. }).always(
  419. function() {
  420. this.setState({
  421. loading: false
  422. });
  423. }.bind(this)
  424. );
  425. },
  426. //阻止默认冒泡
  427. stopPropagation(e) {
  428. e.stopPropagation();
  429. e.nativeEvent.stopImmediatePropagation();
  430. },
  431. imghandleCancel() {
  432. this.setState({
  433. imgeditvisible: false
  434. });
  435. },
  436. //项目列表整行点击
  437. tableRowClick(record, index) {
  438. this.state.RowData = record;
  439. this.setState({
  440. editvisible: true
  441. });
  442. this.detailes(record);
  443. },
  444. edithandleCancel(e) {
  445. this.setState(
  446. {
  447. editvisible: false
  448. },
  449. () => {
  450. this.addReset();
  451. }
  452. );
  453. this.loadData();
  454. },
  455. search() {
  456. this.loadData();
  457. },
  458. add() {
  459. this.setState({
  460. editvisible: true,
  461. flag: false
  462. });
  463. this.addReset();
  464. },
  465. cancelAdd() {
  466. this.setState(
  467. {
  468. editvisible: false
  469. },
  470. () => {
  471. this.setState({
  472. flag: true
  473. });
  474. this.addReset();
  475. }
  476. );
  477. this.loadData();
  478. },
  479. edit(record, display) {
  480. if (!display) {
  481. if (!this.state.bannerUrl || !this.state.bannerUrl.length) {
  482. message.warning("请上传图片!");
  483. return;
  484. }
  485. if (!this.state.title) {
  486. message.warning("请填写广告标题");
  487. return;
  488. }
  489. if(this.state.locations.length === 0){
  490. message.warning("请选择公司");
  491. return;
  492. }
  493. }
  494. $.ajax({
  495. method: "post",
  496. dataType: "json",
  497. url: globalConfig.context + "/api/admin/banners/updateBanners",
  498. data: {
  499. id: record ? record.id : this.state.id,
  500. sort: this.state.sortNumber,
  501. display: display || this.state.display,
  502. locations: this.state.locations.length === 0 ? undefined : this.state.locations.join(','),
  503. position: this.state.position,
  504. bannerUrl: this.state.bannerUrl
  505. ? this.state.bannerUrl[0].response.data
  506. : undefined,
  507. title: this.state.title,
  508. jumpUrl: this.state.jumpUrl || 'javascript:;',
  509. },
  510. success: function(data) {
  511. let theArr = [];
  512. if (data.error.length || data.data.list == "") {
  513. if (data.error && data.error.length) {
  514. message.warning(data.error[0].message);
  515. }
  516. } else {
  517. message.success('操作成功')
  518. this.cancelAdd();
  519. }
  520. }.bind(this)
  521. }).always(
  522. function() {
  523. this.setState({
  524. loading: false
  525. });
  526. }.bind(this)
  527. );
  528. },
  529. addNew() {
  530. if (!this.state.bannerUrl || !this.state.bannerUrl.length) {
  531. message.warning("请上传图片!");
  532. return;
  533. }
  534. if (!this.state.title) {
  535. message.warning("请填写广告标题");
  536. return;
  537. }
  538. if(this.state.locations.length === 0){
  539. message.warning("请选择公司");
  540. return;
  541. }
  542. $.ajax({
  543. method: "post",
  544. dataType: "json",
  545. url: globalConfig.context + "/api/admin/banners/addBanners",
  546. data: {
  547. sort: this.state.sortNumber,
  548. display: this.state.display,
  549. locations: this.state.locations.join(','),
  550. position: this.state.position,
  551. bannerUrl: this.state.bannerUrl
  552. ? this.state.bannerUrl[0].response.data
  553. : undefined,
  554. title: this.state.title,
  555. jumpUrl: this.state.jumpUrl || 'javascript:;',
  556. },
  557. success: function(data) {
  558. let theArr = [];
  559. if (data.error.length || data.data.list == "") {
  560. if (data.error && data.error.length) {
  561. message.warning(data.error[0].message);
  562. }
  563. } else {
  564. message.warning('添加成功');
  565. this.loadData();
  566. this.cancelAdd();
  567. }
  568. }.bind(this)
  569. }).always(
  570. function() {
  571. this.setState({
  572. loading: false
  573. });
  574. }.bind(this)
  575. );
  576. },
  577. //新增框的清零
  578. addReset() {
  579. this.setState({
  580. bannerUrl: undefined,
  581. title: undefined,
  582. jumpUrl: undefined,
  583. sortNumber: undefined,
  584. display: 1,
  585. position: "0",
  586. locations: [],
  587. indeterminate: false,
  588. checked:false,
  589. });
  590. },
  591. //搜索部分的清零
  592. reset() {
  593. this.setState({
  594. locationSearch: undefined,
  595. positionSearch: undefined,
  596. },()=>{
  597. this.loadData();
  598. })
  599. },
  600. imgOk() {
  601. this.setState({
  602. imgeditvisible: false
  603. });
  604. },
  605. getOrgCodeUrl(e) {
  606. this.setState({ bannerUrl: e });
  607. },
  608. render() {
  609. const FormItem = Form.Item;
  610. const rowSelection = {
  611. selectedRowKeys: this.state.selectedRowKeys,
  612. onChange: (selectedRowKeys, selectedRows) => {
  613. this.setState({
  614. selectedRows: selectedRows.slice(-1),
  615. selectedRowKeys: selectedRowKeys.slice(-1)
  616. });
  617. }
  618. };
  619. const { TextArea } = Input; //文本域
  620. const { TabPane } = Tabs; //标签页
  621. const { MonthPicker, RangePicker, WeekPicker } = DatePicker; //日期输入框
  622. const dateFormat = "YYYY/MM/DD"; //日期格式
  623. const theData = this.state.data || {};
  624. return (
  625. <div className="user-content">
  626. <div className="content-title">
  627. <span>广告列表</span>
  628. <div className="user-search">
  629. <Select
  630. placeholder="请选择广告位置"
  631. style={{ width: 150 }}
  632. value={
  633. this.state.positionSearch
  634. ? this.state.positionSearch + ""
  635. : []
  636. }
  637. onChange={e => {
  638. this.setState({
  639. positionSearch: e
  640. });
  641. }}
  642. >
  643. <Option value="0">首页</Option>
  644. <Option value="1">产品中心</Option>
  645. <Option value="2">战略合作</Option>
  646. <Option value="3">服务客户</Option>
  647. <Option value="4">新闻动态</Option>
  648. <Option value="5">关于科德</Option>
  649. <Option value="6">联系我们</Option>
  650. </Select>
  651. <Select
  652. placeholder="请选择公司"
  653. style={{ width: 150 }}
  654. value={this.state.locationSearch}
  655. onChange={e => {
  656. this.setState({
  657. locationSearch: e
  658. });
  659. }}
  660. >
  661. {
  662. companyList.map((v)=>(
  663. <Option key={v.value} value={v.value}>{v.label}</Option>
  664. ))
  665. }
  666. </Select>
  667. <Button
  668. type="primary"
  669. onClick={this.search}
  670. style={{ marginRight: "10px" }}
  671. >
  672. 搜索
  673. </Button>
  674. <Button onClick={this.reset} style={{ marginRight: "10px" }}>
  675. 重置
  676. </Button>
  677. <Button
  678. type="primary"
  679. onClick={this.add}
  680. style={{ marginLeft: "100px" }}
  681. >
  682. 新增广告
  683. </Button>
  684. </div>
  685. <div className="patent-table">
  686. <SpinContainer spinning={this.state.loading}>
  687. <Table
  688. columns={this.state.columns}
  689. dataSource={this.state.dataSource}
  690. onRowClick={this.tableRowClick}
  691. pagination={this.state.pagination}
  692. bordered
  693. size="small"
  694. />
  695. </SpinContainer>
  696. </div>
  697. </div>
  698. <div className="patent-desc">
  699. <Modal
  700. className="customeDetails"
  701. title={this.state.flag ? "广告详情" : "新增广告"}
  702. visible={this.state.editvisible}
  703. onOk={this.edithandleCancel}
  704. width={"690px"}
  705. onCancel={
  706. this.state.flag ? this.edithandleCancel : this.cancelAdd
  707. }
  708. footer=""
  709. >
  710. <Form
  711. layout="horizontal"
  712. onSubmit={this.edithandleSubmit}
  713. id="demand-form"
  714. >
  715. <SpinContainer spinning={this.state.loading}>
  716. <div className="clearfix">
  717. <FormItem
  718. className="half-item"
  719. labelCol={{ span: 8 }}
  720. wrapperCol={{ span: 12 }}
  721. label="广告位置"
  722. >
  723. <Select
  724. placeholder="请选择广告位置"
  725. value={this.state.position + ""}
  726. onChange={e => {
  727. this.setState({
  728. position: e
  729. });
  730. }}
  731. >
  732. <Option value="0">首页</Option>
  733. <Option value="1">产品中心</Option>
  734. <Option value="2">战略合作</Option>
  735. <Option value="3">服务客户</Option>
  736. <Option value="4">新闻动态</Option>
  737. <Option value="5">关于科德</Option>
  738. <Option value="6">联系我们</Option>
  739. </Select>
  740. </FormItem>
  741. <div className="clearfix">
  742. <FormItem
  743. className="half-item"
  744. labelCol={{ span: 8 }}
  745. wrapperCol={{ span: 12 }}
  746. label="广告标题"
  747. >
  748. <Input
  749. placeholder="请输入标题"
  750. value={this.state.title}
  751. onChange={e => {
  752. this.setState({ title: e.target.value });
  753. }}
  754. style={{ width: "240px" }}
  755. />
  756. </FormItem>
  757. </div>
  758. <div className="clearfix">
  759. <FormItem
  760. className="half-item"
  761. labelCol={{ span: 8 }}
  762. wrapperCol={{ span: 12 }}
  763. label="跳转地址"
  764. >
  765. <Input
  766. placeholder="请输入跳转地址"
  767. value={this.state.jumpUrl}
  768. onChange={e => {
  769. this.setState({ jumpUrl: e.target.value });
  770. }}
  771. style={{ width: "240px" }}
  772. />
  773. </FormItem>
  774. </div>
  775. <div className="clearfix">
  776. <FormItem
  777. className="half-item"
  778. labelCol={{ span: 8 }}
  779. wrapperCol={{ span: 12 }}
  780. label="排序"
  781. >
  782. <Input
  783. placeholder="请输入排序"
  784. value={this.state.sortNumber}
  785. onChange={e => {
  786. this.setState({ sortNumber: e.target.value });
  787. }}
  788. style={{ width: "240px" }}
  789. />
  790. </FormItem>
  791. </div>
  792. <div className="clearfix">
  793. <FormItem
  794. className="half-item"
  795. labelCol={{ span: 8 }}
  796. wrapperCol={{ span: 12 }}
  797. label="是否显示"
  798. >
  799. <Radio.Group
  800. onChange={e => {
  801. this.setState({
  802. display: e.target.value
  803. });
  804. }}
  805. value={this.state.display}
  806. >
  807. <Radio value={1}>是</Radio>
  808. <Radio value={0}>否</Radio>
  809. </Radio.Group>
  810. </FormItem>
  811. </div>
  812. </div>
  813. <div className="clearfix">
  814. <FormItem
  815. className="half-item"
  816. labelCol={{ span: 8 }}
  817. wrapperCol={{ span: 14 }}
  818. label="公司"
  819. >
  820. <Checkbox indeterminate={this.state.indeterminate} checked={this.state.checked} onChange={(e)=>{
  821. this.setState({
  822. locations: e.target.checked ? getCompanyValueArray():[],
  823. indeterminate: false,
  824. checked:e.target.checked
  825. })
  826. }}>全选</Checkbox>
  827. <Checkbox.Group
  828. options={companyList}
  829. value={this.state.locations}
  830. onChange={(e) => {
  831. this.setState({
  832. locations: e,
  833. indeterminate: companyList.length > e.length,
  834. checked: companyList.length === e.length
  835. });
  836. }}
  837. />
  838. </FormItem>
  839. </div>
  840. <div className="clearfix">
  841. <FormItem
  842. labelCol={{ span: 4 }}
  843. wrapperCol={{ span: 18 }}
  844. label="广告大图"
  845. >
  846. <PicturesWall
  847. fileList={this.getOrgCodeUrl}
  848. pictureUrl={this.state.bannerUrl}
  849. />
  850. <p>建议尺寸:1920X680 图片建议:要清晰。</p>
  851. </FormItem>
  852. </div>
  853. <div className="clearfix">
  854. <Button
  855. type="primary"
  856. size="large"
  857. onClick={() => {
  858. this.state.flag ? this.edit() : this.addNew();
  859. }}
  860. style={{
  861. display: "block",
  862. margin: "auto"
  863. }}
  864. >
  865. 保存
  866. </Button>
  867. </div>
  868. </SpinContainer>
  869. </Form>
  870. </Modal>
  871. </div>
  872. <Modal
  873. visible={this.state.imgeditvisible}
  874. onCancel={this.imghandleCancel}
  875. onOk={this.imgOk}
  876. >
  877. <img style={{ width: "100%" }} src={this.state.maximg} />
  878. </Modal>
  879. </div>
  880. );
  881. }
  882. })
  883. );
  884. export default AdvertisementList;