|
@@ -1,7 +1,7 @@
|
|
|
/* eslint-disable no-return-assign */
|
|
|
/* eslint-disable camelcase */
|
|
|
import React, { Component, Fragment } from 'react'
|
|
|
-import { Divider, Modal, message,Button,Tag } from 'antd'
|
|
|
+import { Divider, Modal, message, Button, Tag } from 'antd'
|
|
|
import { FilterTable, ImagePreview } from 'wptpc-design'
|
|
|
import { connect } from 'dva'
|
|
|
import { routerRedux } from 'dva/router'
|
|
@@ -10,9 +10,9 @@ import ConfigModal from './components/ConfigModal'
|
|
|
import CopyTemplateModal from './components/CopyTemplateModal'
|
|
|
import { dc } from '@/conf/config'
|
|
|
import { fetchApi_get } from '@/apis/'
|
|
|
-import ExportPower from './components/JsonExport';
|
|
|
-import ImportPower from './components/JsonImport';
|
|
|
-import { delTemplateAction,changePosterState } from './services'
|
|
|
+import ExportPower from './components/JsonExport'
|
|
|
+import ImportPower from './components/JsonImport'
|
|
|
+import { delTemplateAction, changePosterState } from './services'
|
|
|
|
|
|
// less
|
|
|
import styles from './index.less'
|
|
@@ -75,6 +75,7 @@ class Poster extends Component {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
changeState = (status, id) => {
|
|
|
Modal.confirm({
|
|
|
title: status === 0 ? '确定要禁用该海报模板吗' : '确定要启用该海报模板吗',
|
|
@@ -87,12 +88,13 @@ class Poster extends Component {
|
|
|
} else if (status === 0) {
|
|
|
message.success('已启用')
|
|
|
}
|
|
|
- this.refresh();
|
|
|
+ this.refresh()
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
render () {
|
|
|
// 搜索框配置
|
|
|
const filterSettingConfig = {
|
|
@@ -121,9 +123,9 @@ class Poster extends Component {
|
|
|
option: [
|
|
|
{ label: '全部', value: '' },
|
|
|
{ label: '启用', value: 1 },
|
|
|
- { label: '禁用', value: 0 },
|
|
|
+ { label: '禁用', value: 0 }
|
|
|
],
|
|
|
- defaultValue: '',
|
|
|
+ defaultValue: ''
|
|
|
}]
|
|
|
// 查询前触发的函数,进行参数整合
|
|
|
// beforeSearchFunc: (data) => {
|
|
@@ -140,73 +142,109 @@ class Poster extends Component {
|
|
|
// pageSize: 10,
|
|
|
// },
|
|
|
// 每一列配置
|
|
|
- columnConfig: [{
|
|
|
- title: '序号',
|
|
|
- dataIndex: 'id'
|
|
|
- }, {
|
|
|
- title: '海报缩略图',
|
|
|
+ columnConfig: [
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ title: '序号',
|
|
|
+ dataIndex: 'id',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ title: '海报缩略图',
|
|
|
dataIndex: 'preview',
|
|
|
- width:100,
|
|
|
- render: (_, record) => <img src={_} className={styles.previewImg} onClick={this.previewImg.bind(this, record)} />
|
|
|
- }, {
|
|
|
- title: '海报标识',
|
|
|
- dataIndex: 'name'
|
|
|
- }, {
|
|
|
- title: '海报描述',
|
|
|
- dataIndex: 'description'
|
|
|
- },{
|
|
|
- title: '状态',
|
|
|
- dataIndex: 'stateName',
|
|
|
- render: (t, record) => {
|
|
|
- if (record.state === 1) {
|
|
|
- return <Tag color='green'>{t}</Tag>
|
|
|
- } else {
|
|
|
- return <Tag color='red' >{t}</Tag>
|
|
|
- }
|
|
|
- }
|
|
|
- },{
|
|
|
- title: '创建人',
|
|
|
- dataIndex: 'creator'
|
|
|
- },{
|
|
|
- title: '最后修改人',
|
|
|
- dataIndex: 'updater'
|
|
|
- },{
|
|
|
- title: '操作',
|
|
|
- dataIndex: 'actions',
|
|
|
- render: (_, record) => {
|
|
|
- const { id } = record
|
|
|
- return (
|
|
|
- <Fragment>
|
|
|
- <a href={`/poster/edit/${record.id}`}>编辑</a>
|
|
|
- {record.state === 0 && <>
|
|
|
+ width: 100,
|
|
|
+ render: (_, record) => (
|
|
|
+ <img
|
|
|
+ src={_}
|
|
|
+ className={styles.previewImg}
|
|
|
+ onClick={this.previewImg.bind(this, record)}
|
|
|
+ />
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ title: '海报标识',
|
|
|
+ dataIndex: 'name',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ title: '海报描述',
|
|
|
+ dataIndex: 'description',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ title: '状态',
|
|
|
+ dataIndex: 'stateName',
|
|
|
+ render: (t, record) => {
|
|
|
+ if (record.state === 1) {
|
|
|
+ return <Tag color="green">{t}</Tag>;
|
|
|
+ } else {
|
|
|
+ return <Tag color="red">{t}</Tag>;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ title: '创建人',
|
|
|
+ dataIndex: 'creator',
|
|
|
+ width: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ title: '最后修改人',
|
|
|
+ dataIndex: 'updater',
|
|
|
+ width: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ align: 'center',
|
|
|
+ title: '操作',
|
|
|
+ dataIndex: 'actions',
|
|
|
+ render: (_, record) => {
|
|
|
+ const { id } = record;
|
|
|
+ return (
|
|
|
+ <Fragment>
|
|
|
+ <a href={`/poster/edit/${record.id}`}>编辑</a>
|
|
|
+ {record.state === 0 && (
|
|
|
+ <>
|
|
|
+ <Divider type="vertical" />
|
|
|
+ <a onClick={this.changeState.bind(this, 1, id)}>启用</a>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ {record.state === 1 && (
|
|
|
+ <>
|
|
|
+ <Divider type="vertical" />
|
|
|
+ <a onClick={this.changeState.bind(this, 0, id)}>禁用</a>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ <Divider type="vertical" />
|
|
|
+ <a onClick={this.delImg.bind(this, record)}>删除</a>
|
|
|
<Divider type="vertical" />
|
|
|
- <a onClick={this.changeState.bind(this,1,id)}>启用</a>
|
|
|
- </>}
|
|
|
- {record.state === 1 && <>
|
|
|
+ <ExportPower record={record} />
|
|
|
<Divider type="vertical" />
|
|
|
- <a onClick={this.changeState.bind(this,0,id)}>禁用</a>
|
|
|
- </>}
|
|
|
- <Divider type="vertical" />
|
|
|
- <a onClick={this.delImg.bind(this, record)}>删除</a>
|
|
|
- <Divider type="vertical" />
|
|
|
- <ExportPower record={ record}/>
|
|
|
- <Divider type="vertical" />
|
|
|
- <a onClick={this.handleConfig.bind(this, record)}>查看配置</a>
|
|
|
- <Divider type="vertical" />
|
|
|
- <a onClick={this.handleCopyTemplate.bind(this, record)}>复制模版</a>
|
|
|
- </Fragment>
|
|
|
- )
|
|
|
- }
|
|
|
- }],
|
|
|
+ <a onClick={this.handleConfig.bind(this, record)}>查看配置</a>
|
|
|
+ <Divider type="vertical" />
|
|
|
+ <a onClick={this.handleCopyTemplate.bind(this, record)}>复制模版</a>
|
|
|
+ </Fragment>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
batchBtnsJxs: [
|
|
|
- <Button type='primary' onClick={(e) => { this.props.dispatch(routerRedux.push({ pathname: '/poster/edit' })) }}>创建</Button>,
|
|
|
- <ImportPower refresh={ this.refresh}/>
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ onClick={e => {
|
|
|
+ this.props.dispatch(routerRedux.push({ pathname: '/poster/edit' }));
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 创建
|
|
|
+ </Button>,
|
|
|
+ <ImportPower refresh={this.refresh} />,
|
|
|
],
|
|
|
// 刷新页面
|
|
|
getRefresh: refresh => {
|
|
|
- this.refresh = refresh
|
|
|
- }
|
|
|
- }
|
|
|
+ this.refresh = refresh;
|
|
|
+ },
|
|
|
+ };
|
|
|
|
|
|
const { imgs, visible } = this.state
|
|
|
return (
|