-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
changge
committed
Oct 11, 2018
1 parent
5f88c04
commit 07a48f9
Showing
5 changed files
with
133 additions
and
15 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,99 @@ | ||
import React from 'react' | ||
import './index.scss' | ||
import { Input, Upload, Icon, message, Button ,Select} from 'antd' | ||
import { getBase64, beforeUpload,getQueryString } from '../../util' | ||
import {Redirect,withRouter} from 'react-router-dom' | ||
import { Input, Upload, Icon, message, Button, Select } from 'antd' | ||
import { getBase64, beforeUpload, getQueryString } from '../../util' | ||
import { Redirect, withRouter } from 'react-router-dom' | ||
import axios from 'axios' | ||
@withRouter | ||
class EditAlbum extends React.Component { | ||
constructor(){ | ||
constructor() { | ||
super() | ||
this.state={ | ||
albumId:'' | ||
this.state = { | ||
albumId: '', | ||
photoList: [], | ||
activityName: '', | ||
activityNameSelected: [], | ||
classIfy: [], | ||
author:'', | ||
date:'', | ||
bannerPic:'', | ||
coverPic:'', | ||
desc:'' | ||
} | ||
} | ||
componentDidMount(){ | ||
let albumId=getQueryString('id') | ||
this.setState({ | ||
albumId | ||
componentDidMount() { | ||
let albumId = getQueryString('id') | ||
debugger | ||
axios.post('/album/info',{albumId}).then(res => { | ||
if(res.request.status===200&&res.data.code===0){ | ||
message.success(res.data.error_Msg) | ||
const {activityName,date,classIfy,photoList,bannerPic,coverPic,desc}=res.data.data | ||
this.setState({ | ||
activityName,date,classIfy,photoList,bannerPic,coverPic,desc | ||
}) | ||
}else{ | ||
console.error("error") | ||
} | ||
}) | ||
console.log(albumId) | ||
} | ||
render(){ | ||
return null | ||
handleSelectChange = () => { | ||
|
||
} | ||
|
||
render() { | ||
const props = { | ||
name: 'file', | ||
multiple: true, | ||
action: '//jsonplaceholder.typicode.com/posts/', | ||
onChange(info) { | ||
const status = info.file.status; | ||
if (status !== 'uploading') { | ||
console.log(info.file, info.fileList); | ||
} | ||
if (status === 'done') { | ||
message.success(`${info.file.name} file uploaded successfully.`); | ||
} else if (status === 'error') { | ||
message.error(`${info.file.name} file upload failed.`); | ||
} | ||
}, | ||
}; | ||
const { albumId, photoList, activityName, activityNameSelected, classIfy } = this.state | ||
const Option = Select.Option | ||
const Dragger = Upload.Dragger; | ||
console.log(this.state) | ||
return <div className="edit-album"> | ||
<div className="edit-album-section"> | ||
<p>相册编辑</p> | ||
</div> | ||
<div className="edit-album-section"> | ||
<div className="edit-album-section-title"> | ||
活动分类 | ||
</div> | ||
<div className="edit-album-section-select"> | ||
{classIfy.length !== 0 && <Select value={activityNameSelected} onChange={this.handleSelectChange}> | ||
{classIfy.map(el => { | ||
return <Option value={el._id}>{el.title}</Option> | ||
}) | ||
} | ||
</Select> | ||
} | ||
</div> | ||
<div className="edit-album-section-upload"> | ||
<Dragger {...props}> | ||
<p className="ant-upload-drag-icon"> | ||
<Icon type="inbox" /> | ||
</p> | ||
<p className="ant-upload-text">单机或者拖拽文件上传</p> | ||
<p className="ant-upload-hint">支持单文件,多选,目录上传</p> | ||
</Dragger> | ||
</div> | ||
</div> | ||
<div className="edit-album-section"> | ||
<div className="edit-album-section-pic-list"> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
} | ||
} | ||
export default EditAlbum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.edit-album{ | ||
max-width: 320px; | ||
margin:0 auto; | ||
width: 100%; | ||
min-width: 300px; | ||
min-height: 600px; | ||
padding: 10px; | ||
box-sizing:content-box; | ||
border-radius: 10px; | ||
background-color: #fff; | ||
.edit-album-section{ | ||
width: 100%; | ||
min-height: 60px; | ||
.edit-album-section-title{ | ||
width: 100%; | ||
height: 30px; | ||
background: #dcd5d5; | ||
line-height: 30px; | ||
border-radius: 5px; | ||
text-indent: 10px; | ||
margin:10px 0px 10px 0px; | ||
} | ||
} | ||
} |