From d828320e6384df831839bde49f09cf2ad1c49899 Mon Sep 17 00:00:00 2001 From: liuwh <liuwh@hugeinfo.com.cn> Date: Thu, 27 Feb 2020 08:43:55 +0800 Subject: [PATCH] 提交 --- SunshineIns/src/page/ActiveManageEdit.jsx | 69 +++++++++++++++++++++++++++------- 1 files changed, 55 insertions(+), 14 deletions(-) diff --git a/SunshineIns/src/page/ActiveManageEdit.jsx b/SunshineIns/src/page/ActiveManageEdit.jsx index 534bf2e..dcf8803 100644 --- a/SunshineIns/src/page/ActiveManageEdit.jsx +++ b/SunshineIns/src/page/ActiveManageEdit.jsx @@ -77,7 +77,7 @@ if (endTime == null) { endTime = Date.now(); } - console.log + console.log(res.attachments) this.setState({ savedate: { ...res.activity, @@ -93,6 +93,7 @@ status: res.activity.activityStatus || '', disabled: res.activity.activityStatus == 0 ? false : true, dateSource: res.personList || [], + // fileList: res.attachments.length > 0 ? res.attachments.filter(item=>(item.typeId==1000)) : [], fileList: res.attachments || [], loading: false, }); @@ -118,8 +119,8 @@ return; } if (savedate.activityPhone) { - if (!validator.phone(savedate.activityPhone)) { - return message.warning("联系电话格式不正确"); + if (!savedate.activityPhone) { + return message.warning("联系电话不能为空"); } } Fetch.saveActive(savedate) @@ -295,14 +296,35 @@ handleCancel = () => this.setState({ previewVisible: false }) render() { - const { savedate, previewVisible, previewImage,editorState, fileList, dateSource, code, hitList, activityType, disabled, loading } = this.state; - console.log('disabled', disabled) + const { savedate, previewVisible, previewImage, editorState, fileList, dateSource, code, hitList, activityType, disabled, loading } = this.state; + console.log('disabled', fileList) const props = { action: domain + 'api/v1/attachment/materials?entityId=' + savedate.id, onChange: ({ file, fileList }) => { this.setState({ fileList }); }, - fileList: fileList, + fileList: fileList.filter(item=>(item.typeId==1000)), + onRemove: (file) => { + Fetch.deleteAttachment(file.uid) + .then(res => { + message.success("移除成功!"); + }); + this.setState(({ fileList }) => { + const index = fileList.indexOf(file); + const newFileList = fileList.slice(); + newFileList.splice(index, 1); + return { + fileList: newFileList, + }; + }); + } + }; + const bottmProps = { + action: domain + 'api/v1/attachment/materials?entityId=' + savedate.id, + onChange: ({ file, fileList }) => { + this.setState({ fileList }); + }, + fileList: fileList.filter(item=>(item.typeId==1020)), onRemove: (file) => { Fetch.deleteAttachment(file.uid) .then(res => { @@ -382,7 +404,7 @@ <Spin spinning={loading}> <HeadView history={this.props.history} /> <Breadcrumb style={{ padding: '20px' }}> - <Breadcrumb.Item><a href="index.html#/activeManage">活动管理</a></Breadcrumb.Item> + <Breadcrumb.Item><a href="index.html#/activeManage">法治活动</a></Breadcrumb.Item> <Breadcrumb.Item>活动发布</Breadcrumb.Item> </Breadcrumb> <BusDetailView type='活动发布' > @@ -396,15 +418,8 @@ <Option value='act_3'>普法预约</Option> </Select> </Col> - <Col span={12} pull={0}></Col> - </Row> - </div> - <div style={divStyle}> - <Row type="flex" align='middle' justify="space-around"> <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>主持人</span></Col> <Col span={6} push={0} ><Input disabled={disabled} placeholder="请输入主持人姓名" style={{ width: '300px' }} name='host' onChange={this.saveInputChange} value={savedate.host || ""} /></Col> - <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>报名要求</span></Col> - <Col span={6} push={0} ><Input disabled={disabled} placeholder="请输入报名要求" style={{ width: '300px' }} name='requirement' onChange={this.saveInputChange} value={savedate.requirement || ""} /></Col> </Row> </div> @@ -446,6 +461,12 @@ <Row type="flex" align='middle' justify="space-around"> <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>活动描述</span></Col> <Col span={18} push={0} ><TextArea disabled={disabled} rows={4} placeholder="请输入活动描述" style={{ width: '92%' }} value={savedate.activityDesc || ""} onChange={this.saveInputChange} name='activityDesc' /></Col> + </Row> + </div> + <div style={divStyle}> + <Row type="flex" align='middle' justify="space-around"> + <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>报名要求</span></Col> + <Col span={18} push={0} ><TextArea disabled={disabled} placeholder="请输入报名要求" style={{ width: '92%' }} name='requirement' onChange={this.saveInputChange} value={savedate.requirement || ""} /></Col> </Row> </div> @@ -515,6 +536,26 @@ </div> : null) : null } { + activityType == 'act_2' || activityType == 'act_3' ? (dateSource.length > 0 ? + <div style={divStyle}> + <Divider orientation="left" style={{ margin: '20px', width: '97%' }}>培训结果</Divider> + <div style={divStyle}> + <Row type="flex" align='top' justify="space-around"> + <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>添加图片</span></Col> + <Col span={18} push={0} > + <Upload disabled={disabled} listType="picture-card" onPreview={this.handlePreview} {...bottmProps}> + + </Upload> + <Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}> + <img alt="example" style={{ width: '100%' }} src={previewImage} /> + </Modal> + </Col> + </Row> + </div> + </div> : null) : null + } + + { activityType == 'act_1' && ( savedate.activityStatus == null || savedate.activityStatus == 0 ? <div style={{ display: 'flex', justifyContent: 'center' }}> -- Gitblit v1.8.0