cf-wx-app/src/pages/goodsPublish/goodsPublish.js

213 lines
7.8 KiB
JavaScript
Raw Normal View History

2018-12-06 17:24:34 +08:00
import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text, Input, Radio, RadioGroup, Label } from '@tarojs/components'
import { AtInput, AtForm, AtImagePicker, AtTextarea, AtRadio, AtButton } from 'taro-ui'
import './goodsPublish.scss'
class GoodsPublish extends Component {
config = {
navigationBarTitleText: '商品发布'
}
constructor() {
super(...arguments)
this.state = {
files: [{
url: 'https://jimczj.gitee.io/lazyrepay/aragaki1.jpeg',
},
{
url: 'https://jimczj.gitee.io/lazyrepay/aragaki2.jpeg',
},
{
url: 'https://jimczj.gitee.io/lazyrepay/aragaki3.png',
}],
list: [
{
value: '美国',
text: '美国',
checked: false
},
{
value: '中国',
text: '中国',
checked: true
},
{
value: '巴西',
text: '巴西',
checked: false
},
{
value: '日本',
text: '日本',
checked: false
}
]
}
}
onChange(files) {
this.setState({
files
})
}
onFail(mes) {
console.log(mes)
}
onImageClick(index, file) {
console.log(index, file)
}
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
}
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
render() {
return (
<View className='goods-publish'>
<View className='goods-category'>
<View className='border-box'>
<AtInput
name='value'
title='商品类型:'
type='text'
value={this.state.value}
onChange={this.handleChange.bind(this)}
/>
</View>
<AtInput
name='value'
title='商品价格:'
type='text'
placeholder='¥'
value={this.state.value}
onChange={this.handleChange.bind(this)}
/>
<AtInput
name='value'
title='商品单位:'
type='text'
value={this.state.value}
onChange={this.handleChange.bind(this)}
/>
<View className='img-box'>
<View className='title-box'>
<Text className='title'>上传图片:</Text>
</View>
<View className='img-container'>
<AtImagePicker
multiple
files={this.state.files}
onChange={this.onChange.bind(this)}
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
/>
</View>
</View>
<View className='shoptype-box'>
<View className='title-box'>
<Text className='title'>商品分类:</Text>
</View>
<View className='shoptype-container'>
<View className='title-box'>
<Text className='title'>国家:</Text>
</View>
<View className='radio-box'>
<RadioGroup>
{this.state.list.map((item, i) => {
return (
<Label className='radio-list__label' for={i} key={i}>
<Radio color='#FF9500' className='radio-list__radio' value={item.value} checked={item.checked}>{item.text}</Radio>
</Label>
)
})}
</RadioGroup>
</View>
<View className='title-box'>
<Text className='title'>国家:</Text>
</View>
<View className='radio-box'>
<RadioGroup>
{this.state.list.map((item, i) => {
return (
<Label className='radio-list__label' for={i} key={i}>
<Radio color='#FF9500' className='radio-list__radio' value={item.value} checked={item.checked}>{item.text}</Radio>
</Label>
)
})}
</RadioGroup>
</View>
<View className='title-box'>
<Text className='title'>国家:</Text>
</View>
<View className='radio-box'>
<RadioGroup>
{this.state.list.map((item, i) => {
return (
<Label className='radio-list__label' for={i} key={i}>
<Radio color='#FF9500' className='radio-list__radio' value={item.value} checked={item.checked}>{item.text}</Radio>
</Label>
)
})}
</RadioGroup>
</View>
</View>
</View>
<View className='description-box'>
<View className='title-box'>
<Text className='title'>商品简介:</Text>
</View>
<AtTextarea
value={this.state.value}
onChange={this.handleChange.bind(this)}
maxlength='200'
placeholder='你的问题是...'
/>
</View>
</View>
<View className='button-box'>
<View className='button'>
<AtButton type='primary' size='small'>发布</AtButton>
</View>
<View className='button'>
<AtButton type='primary' size='small'>发布并新增</AtButton>
</View>
<View className='button'>
<AtButton type='primary' size='small'>商品列表</AtButton>
</View>
</View>
</View>
)
}
}
export default GoodsPublish