Commit a6054f56 by chengming

新增投票缩略图

parent 9ee63012
...@@ -308,11 +308,11 @@ class TreeItem extends React.Component { ...@@ -308,11 +308,11 @@ class TreeItem extends React.Component {
className={Styles.pmEditIcon} className={Styles.pmEditIcon}
onClick={() => this.showModal("2")} onClick={() => this.showModal("2")}
/> />
{/* <Icon <Icon
type="delete" type="delete"
className={Styles.pmEditIcon} className={Styles.pmEditIcon}
onClick={() => this.onDelete()} onClick={() => this.onDelete()}
/> */} />
</span> </span>
) )
: ""} : ""}
...@@ -868,7 +868,7 @@ class Information extends React.Component { ...@@ -868,7 +868,7 @@ class Information extends React.Component {
parentID={this.state.ificationList} parentID={this.state.ificationList}
postAddNewsLists={this.AddNewsList} postAddNewsLists={this.AddNewsList}
postEditNewsLists={this.EditNewsLists} postEditNewsLists={this.EditNewsLists}
// newsDelete={this.onNewsDelete} newsDelete={this.onNewsDelete}
onTableList={this.onTableList} onTableList={this.onTableList}
/> />
} }
...@@ -888,7 +888,7 @@ class Information extends React.Component { ...@@ -888,7 +888,7 @@ class Information extends React.Component {
parentID={this.state.ificationList} parentID={this.state.ificationList}
postAddNewsLists={this.AddNewsList} postAddNewsLists={this.AddNewsList}
postEditNewsLists={this.EditNewsLists} postEditNewsLists={this.EditNewsLists}
// newsDelete={this.onNewsDelete} newsDelete={this.onNewsDelete}
onTableList={this.onTableList} onTableList={this.onTableList}
/> />
} }
...@@ -909,7 +909,7 @@ class Information extends React.Component { ...@@ -909,7 +909,7 @@ class Information extends React.Component {
parentID={this.state.ificationList} parentID={this.state.ificationList}
postAddNewsLists={this.AddNewsList} postAddNewsLists={this.AddNewsList}
postEditNewsLists={this.EditNewsLists} postEditNewsLists={this.EditNewsLists}
// newsDelete={this.onNewsDelete} newsDelete={this.onNewsDelete}
onTableList={this.onTableList} onTableList={this.onTableList}
/> />
} }
...@@ -929,7 +929,7 @@ class Information extends React.Component { ...@@ -929,7 +929,7 @@ class Information extends React.Component {
parentID={this.state.ificationList} parentID={this.state.ificationList}
postAddNewsLists={this.AddNewsList} postAddNewsLists={this.AddNewsList}
postEditNewsLists={this.EditNewsLists} postEditNewsLists={this.EditNewsLists}
// newsDelete={this.onNewsDelete} newsDelete={this.onNewsDelete}
onTableList={this.onTableList} onTableList={this.onTableList}
/> />
} }
...@@ -950,7 +950,7 @@ class Information extends React.Component { ...@@ -950,7 +950,7 @@ class Information extends React.Component {
parentID={this.state.ificationList} parentID={this.state.ificationList}
postAddNewsLists={this.AddNewsList} postAddNewsLists={this.AddNewsList}
postEditNewsLists={this.EditNewsLists} postEditNewsLists={this.EditNewsLists}
// newsDelete={this.onNewsDelete} newsDelete={this.onNewsDelete}
onTableList={this.onTableList} onTableList={this.onTableList}
/> />
} }
...@@ -972,7 +972,7 @@ class Information extends React.Component { ...@@ -972,7 +972,7 @@ class Information extends React.Component {
parentID={this.state.ificationList} parentID={this.state.ificationList}
postAddNewsLists={this.AddNewsList} postAddNewsLists={this.AddNewsList}
postEditNewsLists={this.EditNewsLists} postEditNewsLists={this.EditNewsLists}
// newsDelete={this.onNewsDelete} newsDelete={this.onNewsDelete}
onTableList={this.onTableList} onTableList={this.onTableList}
/> />
} }
......
...@@ -171,8 +171,6 @@ class AddTest extends Component { ...@@ -171,8 +171,6 @@ class AddTest extends Component {
handleOk() { handleOk() {
const { surid, tlist } = this.props; const { surid, tlist } = this.props;
const { order, editstate, editid } = this.state; const { order, editstate, editid } = this.state;
console.log(11111, this.addother.state);
// console.log(surid)
this.props.jumpreset(); this.props.jumpreset();
this.setState({ this.setState({
confirmLoading: true, confirmLoading: true,
...@@ -201,6 +199,7 @@ class AddTest extends Component { ...@@ -201,6 +199,7 @@ class AddTest extends Component {
const param = { const param = {
type: values.type, type: values.type,
content: values.content, content: values.content,
logoSrc: values.logoSrc,
contentAppendixUrl: this.state.fileUrl contentAppendixUrl: this.state.fileUrl
? this.state.fileUrl ? this.state.fileUrl
: this.state.testItem.contentAppendixUrl : this.state.testItem.contentAppendixUrl
...@@ -228,6 +227,7 @@ class AddTest extends Component { ...@@ -228,6 +227,7 @@ class AddTest extends Component {
keywords: this.addother.state.keywords, keywords: this.addother.state.keywords,
type: values.type, type: values.type,
content: values.content, content: values.content,
logoSrc: values.logoSrc,
contentAppendixUrl: this.state.fileUrl ? this.state.fileUrl : "", contentAppendixUrl: this.state.fileUrl ? this.state.fileUrl : "",
needAnswer: values.needAnswer ? 1 : 0, needAnswer: values.needAnswer ? 1 : 0,
questionOptions: objs, questionOptions: objs,
......
...@@ -2,6 +2,7 @@ import React, { Component } from "react"; ...@@ -2,6 +2,7 @@ import React, { Component } from "react";
import styles from "./index.less"; import styles from "./index.less";
import { Form, Input, Radio, Row, Col, message } from "antd"; import { Form, Input, Radio, Row, Col, message } from "antd";
import UploadUtil from "../component/UploadUtil"; import UploadUtil from "../component/UploadUtil";
import UploadImageCover from "@/common/UploadImageCover";
const { TextArea } = Input; const { TextArea } = Input;
const FormItem = Form.Item; const FormItem = Form.Item;
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
...@@ -24,8 +25,10 @@ class TestModal extends Component { ...@@ -24,8 +25,10 @@ class TestModal extends Component {
other: "其他", other: "其他",
addother: false, addother: false,
keywords: "", keywords: "",
logoSrc: "",
}; };
this.handleRadioChange = this.handleRadioChange.bind(this); this.handleRadioChange = this.handleRadioChange.bind(this);
this.getImgUrl = this.getImgUrl.bind(this);
} }
handleRadioChange(e) { handleRadioChange(e) {
...@@ -53,8 +56,19 @@ class TestModal extends Component { ...@@ -53,8 +56,19 @@ class TestModal extends Component {
other: defaultValue.otherOptionVo.content, other: defaultValue.otherOptionVo.content,
}); });
} }
if (defaultValue.logoSrc) {
this.setState({
logoSrc: defaultValue.logoSrc,
});
}
}
componentWillReceiveProps(nextProps) {
if (nextProps.logo != this.props.logo) {
this.setState({
logoSrc: nextProps.defaultValue.image,
});
}
} }
remove1 = k => { remove1 = k => {
const { form } = this.props; const { form } = this.props;
const keys1 = form.getFieldValue("keys1"); const keys1 = form.getFieldValue("keys1");
...@@ -78,9 +92,24 @@ class TestModal extends Component { ...@@ -78,9 +92,24 @@ class TestModal extends Component {
getTags = tags => { getTags = tags => {
this.setState({ keywords: tags.join() }); this.setState({ keywords: tags.join() });
}; };
getImgUrl(imageUrl) {
let _this = this;
this.setState(
{
logoSrc: imageUrl,
},
() => {
_this.props.form.setFields({
logoSrc: {
value: imageUrl,
},
});
}
);
}
render() { render() {
const { defaultValue, status } = this.props; const { defaultValue, status } = this.props;
console.log('111111111111',status) console.log('111111111111', status)
const { radioNum } = this.state; const { radioNum } = this.state;
const { getFieldDecorator, getFieldValue } = this.props.form; const { getFieldDecorator, getFieldValue } = this.props.form;
const formItemLayout = { const formItemLayout = {
...@@ -117,12 +146,39 @@ class TestModal extends Component { ...@@ -117,12 +146,39 @@ class TestModal extends Component {
], ],
})(<TextArea rows={4} disabled={status === "look"} />)} })(<TextArea rows={4} disabled={status === "look"} />)}
</FormItem> </FormItem>
{/* 缩略图 */}
{status === "look" && defaultValue.logoSrc && (
<div style={{display: 'flex',marginBottom:'15px'}}>
<div>缩略图:</div>
<img
src={defaultValue.logoSrc}
alt=""
style={{ width: "160px", height: "160px" }}
/>
</div>
)}
{status !== "look" && (
<FormItem {...formItemLayout} label="缩略图:">
{getFieldDecorator("logoSrc", {
initialValue: defaultValue.logoSrc ? defaultValue.logoSrc : "",
})(<UploadImageCover
details={this.state.logoSrc}
getImgUrl={this.getImgUrl}
preRatio={["5/4"]}
maxSize={20 * 1024 * 1024}
extra="图片最佳尺寸:1125*900,比例为5:4,支持jpg、png、jpeg" //task-1110-cwj 删除500k
/>)}
</FormItem>
)}
{/* 图片 */}
{status === "look" && defaultValue.contentAppendixUrl && ( {status === "look" && defaultValue.contentAppendixUrl && (
<div> <div style={{display: 'flex',marginBottom:'15px'}}>
<div>图片:</div>
<img <img
src={defaultValue.contentAppendixUrl} src={defaultValue.contentAppendixUrl}
alt="" alt=""
style={{ width: "200px", height: "160px" }} style={{ width: "200px", height: "100%" }}
/> />
</div> </div>
)} )}
...@@ -139,7 +195,7 @@ class TestModal extends Component { ...@@ -139,7 +195,7 @@ class TestModal extends Component {
)} )}
<div className={styles.sur_test_option} id="dselect"> <div className={styles.sur_test_option} id="dselect">
<RadioGroup style={{ width: "100%" }}> <RadioGroup style={{ width: "100%", }}>
{radioNum === 1 && ( {radioNum === 1 && (
<div className={styles.survey_testmodal_1}> <div className={styles.survey_testmodal_1}>
<Row gutter={23}> <Row gutter={23}>
......
...@@ -209,7 +209,6 @@ class Details extends Component { ...@@ -209,7 +209,6 @@ class Details extends Component {
if (values.type === 1) { if (values.type === 1) {
for (let i = 0; i < values.cont.length; i++) { for (let i = 0; i < values.cont.length; i++) {
if (values.cont[i] == null) continue; if (values.cont[i] == null) continue;
console.log(values, 11111);
objs.push({ objs.push({
content: values.cont[i], content: values.cont[i],
no: values.no[i], no: values.no[i],
...@@ -222,6 +221,7 @@ class Details extends Component { ...@@ -222,6 +221,7 @@ class Details extends Component {
const param = { const param = {
type: values.type, type: values.type,
content: values.content, content: values.content,
logoSrc: values.logoSrc,
contentAppendixUrl: this.state.fileUrl ? this.state.fileUrl : this.state.testItem.contentAppendixUrl ? this.state.testItem.contentAppendixUrl : "", contentAppendixUrl: this.state.fileUrl ? this.state.fileUrl : this.state.testItem.contentAppendixUrl ? this.state.testItem.contentAppendixUrl : "",
needAnswer: values.needAnswer ? 1 : 0, needAnswer: values.needAnswer ? 1 : 0,
questionOptions: objs, questionOptions: objs,
...@@ -245,6 +245,7 @@ class Details extends Component { ...@@ -245,6 +245,7 @@ class Details extends Component {
keywords: this.addother.state.keywords, keywords: this.addother.state.keywords,
type: values.type, type: values.type,
content: values.content, content: values.content,
logoSrc: values.logoSrc,
contentAppendixUrl: this.state.fileUrl ? this.state.fileUrl : "", contentAppendixUrl: this.state.fileUrl ? this.state.fileUrl : "",
needAnswer: values.needAnswer ? 1 : 0, needAnswer: values.needAnswer ? 1 : 0,
questionOptions: objs, questionOptions: objs,
...@@ -448,6 +449,8 @@ class Details extends Component { ...@@ -448,6 +449,8 @@ class Details extends Component {
)} )}
<div <div
style={{ style={{
width: "96%",
margin: "0 auto",
display: "flex", display: "flex",
justifyContent: "space-between", justifyContent: "space-between",
alignItems: "center", alignItems: "center",
...@@ -474,7 +477,7 @@ class Details extends Component { ...@@ -474,7 +477,7 @@ class Details extends Component {
</Button> </Button>
)} )}
</div> </div>
<div> <div style={{ width: "96%", margin: "0 auto" }}>
<Table <Table
size="default" size="default"
columns={columns} columns={columns}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment