advertisementList.jsx 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887
  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. render: r => {
  235. return (
  236. <span>{r === 'javascript:;' ? '' : r}</span>
  237. )
  238. }
  239. },
  240. {
  241. title: "公司",
  242. dataIndex: "locations",
  243. key: "locations",
  244. width:150,
  245. render: r => {
  246. let text = '';
  247. r && r.map((v,i)=>(
  248. text += (i === 0 ? '':',')+getCompanyName(v)
  249. ))
  250. return(
  251. <Tooltip placement="top" title={text}>
  252. {
  253. r && r.map((v,i)=>(
  254. i <= 2 ? (i === 0 ? '':',')+getCompanyName(v) : null
  255. ))
  256. }
  257. {
  258. r.length > 3 ? '.....' : null
  259. }
  260. </Tooltip>
  261. )
  262. }
  263. },
  264. {
  265. title: "是否显示",
  266. dataIndex: "display",
  267. key: "display",
  268. render: s => {
  269. return s ? (
  270. <Tag color="#87d068">显示</Tag>
  271. ) : (
  272. <Tag color="#f50">未显示</Tag>
  273. );
  274. }
  275. },
  276. {
  277. title: "排序",
  278. dataIndex: "sort",
  279. key: "sort"
  280. },
  281. {
  282. title: "操作",
  283. dataIndex: "c",
  284. render: (text, record, index) => {
  285. return (
  286. <div>
  287. {
  288. <Button
  289. type="primary"
  290. onClick={event => {
  291. this.stopPropagation(event);
  292. this.tableRowClick(record);
  293. }}
  294. >
  295. 编辑
  296. </Button>
  297. }
  298. {
  299. <Popconfirm
  300. okText="确定"
  301. cancelText="取消"
  302. title="您确定删除?删除后,广告将不再显示"
  303. onConfirm={() => {
  304. this.delete(record.id);
  305. }}
  306. >
  307. <Button
  308. type="danger"
  309. style={{ marginLeft: "10px" }}
  310. onClick={event => {
  311. this.stopPropagation(event);
  312. }}
  313. >
  314. 删除
  315. </Button>
  316. </Popconfirm>
  317. }
  318. {!record.display ? (
  319. <Button
  320. type="primary"
  321. style={{ marginLeft: "10px" }}
  322. onClick={event => {
  323. this.stopPropagation(event);
  324. this.edit(record, "1");
  325. }}
  326. >
  327. 显示
  328. </Button>
  329. ) : (
  330. <Button
  331. type="primary"
  332. style={{ marginLeft: "10px" }}
  333. onClick={event => {
  334. this.stopPropagation(event);
  335. this.edit(record, "0");
  336. }}
  337. >
  338. 隐藏
  339. </Button>
  340. )}
  341. </div>
  342. );
  343. }
  344. }
  345. ],
  346. //数据列表
  347. dataSource: [
  348. ]
  349. };
  350. },
  351. componentWillMount() {
  352. this.loadData();
  353. },
  354. detailes(record) {
  355. this.setState({
  356. loading: true
  357. });
  358. $.ajax({
  359. method: "get",
  360. dataType: "json",
  361. crossDomain: false,
  362. url: globalConfig.context + "/api/admin/banners/selectBanners",
  363. data: {
  364. id: record.id
  365. },
  366. success: function(data) {
  367. let thisdata = data.data;
  368. this.setState({
  369. id: thisdata.id,
  370. title: thisdata.title,
  371. jumpUrl: thisdata.jumpUrl === 'javascript:;' ? undefined : thisdata.jumpUrl,
  372. bannerUrl: thisdata.bannerUrl
  373. ? splitUrl(thisdata.bannerUrl, ",", globalConfig.avatarUploadHost)
  374. : [],
  375. sortNumber: thisdata.sort,
  376. display: thisdata.display,
  377. position: thisdata.position,
  378. locations: thisdata.locations,
  379. checked:thisdata.locations.length === companyList.length,
  380. indeterminate: thisdata.locations.length < companyList.length,
  381. });
  382. }.bind(this)
  383. }).always(
  384. function() {
  385. this.setState({
  386. loading: false
  387. });
  388. }.bind(this)
  389. );
  390. },
  391. //点击大图
  392. maximg(url) {
  393. this.setState({
  394. imgeditvisible: true,
  395. maximg: url
  396. });
  397. },
  398. //删除按钮
  399. delete(id) {
  400. $.ajax({
  401. method: "post",
  402. dataType: "json",
  403. crossDomain: false,
  404. url: globalConfig.context + "/api/admin/banners/deleteBanners",
  405. data: {
  406. id
  407. },
  408. success: function(data) {
  409. this.loadData();
  410. }.bind(this)
  411. }).always(
  412. function() {
  413. this.setState({
  414. loading: false
  415. });
  416. }.bind(this)
  417. );
  418. },
  419. //阻止默认冒泡
  420. stopPropagation(e) {
  421. e.stopPropagation();
  422. e.nativeEvent.stopImmediatePropagation();
  423. },
  424. imghandleCancel() {
  425. this.setState({
  426. imgeditvisible: false
  427. });
  428. },
  429. //项目列表整行点击
  430. tableRowClick(record, index) {
  431. this.state.RowData = record;
  432. this.setState({
  433. editvisible: true
  434. });
  435. this.detailes(record);
  436. },
  437. edithandleCancel(e) {
  438. this.setState(
  439. {
  440. editvisible: false
  441. },
  442. () => {
  443. this.addReset();
  444. }
  445. );
  446. this.loadData();
  447. },
  448. search() {
  449. this.loadData();
  450. },
  451. add() {
  452. this.setState({
  453. editvisible: true,
  454. flag: false
  455. });
  456. this.addReset();
  457. },
  458. cancelAdd() {
  459. this.setState(
  460. {
  461. editvisible: false
  462. },
  463. () => {
  464. this.setState({
  465. flag: true
  466. });
  467. this.addReset();
  468. }
  469. );
  470. this.loadData();
  471. },
  472. edit(record, display) {
  473. if (!display) {
  474. if (!this.state.bannerUrl || !this.state.bannerUrl.length) {
  475. message.warning("请上传图片!");
  476. return;
  477. }
  478. if (!this.state.title) {
  479. message.warning("请填写广告标题");
  480. return;
  481. }
  482. if(this.state.locations.length === 0){
  483. message.warning("请选择公司");
  484. return;
  485. }
  486. }
  487. $.ajax({
  488. method: "post",
  489. dataType: "json",
  490. url: globalConfig.context + "/api/admin/banners/updateBanners",
  491. data: {
  492. id: record ? record.id : this.state.id,
  493. sort: this.state.sortNumber,
  494. display: display || this.state.display,
  495. locations: this.state.locations.length === 0 ? undefined : this.state.locations.join(','),
  496. position: this.state.position,
  497. bannerUrl: this.state.bannerUrl
  498. ? this.state.bannerUrl[0].response.data
  499. : undefined,
  500. title: this.state.title,
  501. jumpUrl: this.state.jumpUrl || 'javascript:;',
  502. },
  503. success: function(data) {
  504. let theArr = [];
  505. if (data.error.length || data.data.list == "") {
  506. if (data.error && data.error.length) {
  507. message.warning(data.error[0].message);
  508. }
  509. } else {
  510. message.success('操作成功')
  511. this.cancelAdd();
  512. }
  513. }.bind(this)
  514. }).always(
  515. function() {
  516. this.setState({
  517. loading: false
  518. });
  519. }.bind(this)
  520. );
  521. },
  522. addNew() {
  523. if (!this.state.bannerUrl || !this.state.bannerUrl.length) {
  524. message.warning("请上传图片!");
  525. return;
  526. }
  527. if (!this.state.title) {
  528. message.warning("请填写广告标题");
  529. return;
  530. }
  531. if(this.state.locations.length === 0){
  532. message.warning("请选择公司");
  533. return;
  534. }
  535. $.ajax({
  536. method: "post",
  537. dataType: "json",
  538. url: globalConfig.context + "/api/admin/banners/addBanners",
  539. data: {
  540. sort: this.state.sortNumber,
  541. display: this.state.display,
  542. locations: this.state.locations.join(','),
  543. position: this.state.position,
  544. bannerUrl: this.state.bannerUrl
  545. ? this.state.bannerUrl[0].response.data
  546. : undefined,
  547. title: this.state.title,
  548. jumpUrl: this.state.jumpUrl || 'javascript:;',
  549. },
  550. success: function(data) {
  551. let theArr = [];
  552. if (data.error.length || data.data.list == "") {
  553. if (data.error && data.error.length) {
  554. message.warning(data.error[0].message);
  555. }
  556. } else {
  557. message.warning('添加成功');
  558. this.loadData();
  559. this.cancelAdd();
  560. }
  561. }.bind(this)
  562. }).always(
  563. function() {
  564. this.setState({
  565. loading: false
  566. });
  567. }.bind(this)
  568. );
  569. },
  570. //新增框的清零
  571. addReset() {
  572. this.setState({
  573. bannerUrl: undefined,
  574. title: undefined,
  575. jumpUrl: undefined,
  576. sortNumber: undefined,
  577. display: 1,
  578. position: "0",
  579. locations: [],
  580. indeterminate: false,
  581. checked:false,
  582. });
  583. },
  584. //搜索部分的清零
  585. reset() {
  586. this.setState({
  587. locationSearch: undefined,
  588. positionSearch: undefined,
  589. },()=>{
  590. this.loadData();
  591. })
  592. },
  593. imgOk() {
  594. this.setState({
  595. imgeditvisible: false
  596. });
  597. },
  598. getOrgCodeUrl(e) {
  599. this.setState({ bannerUrl: e });
  600. },
  601. render() {
  602. const FormItem = Form.Item;
  603. const rowSelection = {
  604. selectedRowKeys: this.state.selectedRowKeys,
  605. onChange: (selectedRowKeys, selectedRows) => {
  606. this.setState({
  607. selectedRows: selectedRows.slice(-1),
  608. selectedRowKeys: selectedRowKeys.slice(-1)
  609. });
  610. }
  611. };
  612. const { TextArea } = Input; //文本域
  613. const { TabPane } = Tabs; //标签页
  614. const { MonthPicker, RangePicker, WeekPicker } = DatePicker; //日期输入框
  615. const dateFormat = "YYYY/MM/DD"; //日期格式
  616. const theData = this.state.data || {};
  617. return (
  618. <div className="user-content">
  619. <div className="content-title">
  620. <span>广告列表</span>
  621. <div className="user-search">
  622. <Select
  623. placeholder="请选择广告位置"
  624. style={{ width: 150 }}
  625. value={
  626. this.state.positionSearch
  627. ? this.state.positionSearch + ""
  628. : []
  629. }
  630. onChange={e => {
  631. this.setState({
  632. positionSearch: e
  633. });
  634. }}
  635. >
  636. <Option value="0">首页</Option>
  637. <Option value="1">产品中心</Option>
  638. <Option value="2">战略合作</Option>
  639. <Option value="3">服务客户</Option>
  640. <Option value="4">新闻动态</Option>
  641. <Option value="5">关于科德</Option>
  642. <Option value="6">联系我们</Option>
  643. </Select>
  644. <Select
  645. placeholder="请选择公司"
  646. style={{ width: 150 }}
  647. value={this.state.locationSearch}
  648. onChange={e => {
  649. this.setState({
  650. locationSearch: e
  651. });
  652. }}
  653. >
  654. {
  655. companyList.map((v)=>(
  656. <Option key={v.value} value={v.value}>{v.label}</Option>
  657. ))
  658. }
  659. </Select>
  660. <Button
  661. type="primary"
  662. onClick={this.search}
  663. style={{ marginRight: "10px" }}
  664. >
  665. 搜索
  666. </Button>
  667. <Button onClick={this.reset} style={{ marginRight: "10px" }}>
  668. 重置
  669. </Button>
  670. <Button
  671. type="primary"
  672. onClick={this.add}
  673. style={{ marginLeft: "100px" }}
  674. >
  675. 新增广告
  676. </Button>
  677. </div>
  678. <div className="patent-table">
  679. <SpinContainer spinning={this.state.loading}>
  680. <Table
  681. columns={this.state.columns}
  682. dataSource={this.state.dataSource}
  683. onRowClick={this.tableRowClick}
  684. pagination={this.state.pagination}
  685. bordered
  686. size="small"
  687. />
  688. </SpinContainer>
  689. </div>
  690. </div>
  691. <div className="patent-desc">
  692. <Modal
  693. className="customeDetails"
  694. title={this.state.flag ? "广告详情" : "新增广告"}
  695. visible={this.state.editvisible}
  696. onOk={this.edithandleCancel}
  697. width={"690px"}
  698. onCancel={
  699. this.state.flag ? this.edithandleCancel : this.cancelAdd
  700. }
  701. footer=""
  702. >
  703. <Form
  704. layout="horizontal"
  705. onSubmit={this.edithandleSubmit}
  706. id="demand-form"
  707. >
  708. <SpinContainer spinning={this.state.loading}>
  709. <div className="clearfix">
  710. <FormItem
  711. className="half-item"
  712. labelCol={{ span: 8 }}
  713. wrapperCol={{ span: 12 }}
  714. label="广告位置"
  715. >
  716. <Select
  717. placeholder="请选择广告位置"
  718. value={this.state.position + ""}
  719. onChange={e => {
  720. this.setState({
  721. position: e
  722. });
  723. }}
  724. >
  725. <Option value="0">首页</Option>
  726. <Option value="1">产品中心</Option>
  727. <Option value="2">战略合作</Option>
  728. <Option value="3">服务客户</Option>
  729. <Option value="4">新闻动态</Option>
  730. <Option value="5">关于科德</Option>
  731. <Option value="6">联系我们</Option>
  732. </Select>
  733. </FormItem>
  734. <div className="clearfix">
  735. <FormItem
  736. className="half-item"
  737. labelCol={{ span: 8 }}
  738. wrapperCol={{ span: 12 }}
  739. label="广告标题"
  740. >
  741. <Input
  742. placeholder="请输入标题"
  743. value={this.state.title}
  744. onChange={e => {
  745. this.setState({ title: e.target.value });
  746. }}
  747. style={{ width: "240px" }}
  748. />
  749. </FormItem>
  750. </div>
  751. <div className="clearfix">
  752. <FormItem
  753. className="half-item"
  754. labelCol={{ span: 8 }}
  755. wrapperCol={{ span: 12 }}
  756. label="跳转地址"
  757. >
  758. <Input
  759. placeholder="请输入跳转地址"
  760. value={this.state.jumpUrl}
  761. onChange={e => {
  762. this.setState({ jumpUrl: e.target.value });
  763. }}
  764. style={{ width: "240px" }}
  765. />
  766. </FormItem>
  767. </div>
  768. <div className="clearfix">
  769. <FormItem
  770. className="half-item"
  771. labelCol={{ span: 8 }}
  772. wrapperCol={{ span: 12 }}
  773. label="排序"
  774. >
  775. <Input
  776. placeholder="请输入排序"
  777. value={this.state.sortNumber}
  778. onChange={e => {
  779. this.setState({ sortNumber: e.target.value });
  780. }}
  781. style={{ width: "240px" }}
  782. />
  783. </FormItem>
  784. </div>
  785. <div className="clearfix">
  786. <FormItem
  787. className="half-item"
  788. labelCol={{ span: 8 }}
  789. wrapperCol={{ span: 12 }}
  790. label="是否显示"
  791. >
  792. <Radio.Group
  793. onChange={e => {
  794. this.setState({
  795. display: e.target.value
  796. });
  797. }}
  798. value={this.state.display}
  799. >
  800. <Radio value={1}>是</Radio>
  801. <Radio value={0}>否</Radio>
  802. </Radio.Group>
  803. </FormItem>
  804. </div>
  805. </div>
  806. <div className="clearfix">
  807. <FormItem
  808. className="half-item"
  809. labelCol={{ span: 8 }}
  810. wrapperCol={{ span: 14 }}
  811. label="公司"
  812. >
  813. <Checkbox indeterminate={this.state.indeterminate} checked={this.state.checked} onChange={(e)=>{
  814. this.setState({
  815. locations: e.target.checked ? getCompanyValueArray():[],
  816. indeterminate: false,
  817. checked:e.target.checked
  818. })
  819. }}>全选</Checkbox>
  820. <Checkbox.Group
  821. options={companyList}
  822. value={this.state.locations}
  823. onChange={(e) => {
  824. this.setState({
  825. locations: e,
  826. indeterminate: companyList.length > e.length,
  827. checked: companyList.length === e.length
  828. });
  829. }}
  830. />
  831. </FormItem>
  832. </div>
  833. <div className="clearfix">
  834. <FormItem
  835. labelCol={{ span: 4 }}
  836. wrapperCol={{ span: 18 }}
  837. label="广告大图"
  838. >
  839. <PicturesWall
  840. fileList={this.getOrgCodeUrl}
  841. pictureUrl={this.state.bannerUrl}
  842. />
  843. <p>建议尺寸:1920X680 图片建议:要清晰。</p>
  844. </FormItem>
  845. </div>
  846. <div className="clearfix">
  847. <Button
  848. type="primary"
  849. size="large"
  850. onClick={() => {
  851. this.state.flag ? this.edit() : this.addNew();
  852. }}
  853. style={{
  854. display: "block",
  855. margin: "auto"
  856. }}
  857. >
  858. 保存
  859. </Button>
  860. </div>
  861. </SpinContainer>
  862. </Form>
  863. </Modal>
  864. </div>
  865. <Modal
  866. visible={this.state.imgeditvisible}
  867. onCancel={this.imghandleCancel}
  868. onOk={this.imgOk}
  869. >
  870. <img style={{ width: "100%" }} src={this.state.maximg} />
  871. </Modal>
  872. </div>
  873. );
  874. }
  875. })
  876. );
  877. export default AdvertisementList;