import Taro, { Component } from '@tarojs/taro' import { View, Button, Text } from '@tarojs/components' import { AtInput, AtForm, AtImagePicker, AtTextarea, AtRadio, AtButton, Picker} from 'taro-ui' import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent' import copyrightComponent from '../../component/copyrightComponent/copyrightComponent' import './supplyDemandPublish.scss' class SupplyDemand extends Component { config = { navigationBarTitleText: '供求发布' } constructor() { super(...arguments) this.state = { demandingSupplyCate: ['需求', '供应', '人才'], //供求类型选择 demandingSupplyCateSelected: '需求',// 当前供求类型 demandingSupplyState: ['上架', '下架'], // 状态选择 demandingSupplyStateSelected: '上架',// 当前状态 title:'', contactName:'', contactNumber:'', contactAddress:'', content:'', addImg:true, // 是否支持添加图片 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', }] } } // 修改供求类型 demandingSupplyCate = e => { this.setState({ demandingSupplyCateSelected: this.state.demandingSupplyCate[e.detail.value] }) } // 修改供求状态 demSupplyStateChange = e => { this.setState({ demandingSupplyStateSelected: this.state.demandingSupplyState[e.detail.value] }) } //改标题 titleChange(event){ this.setState({title:event}) } contactNameChange(event){ this.setState({contactName:event}) } contactNumberChange(event){ this.setState({contactNumber:event}) } contactAddressChange(event){ this.setState({contactAddress:event.target.value}) } contentChange(event){ this.setState({ content: event.target.value}) } // 添加图片 onChange(files, operationType,index) { if (operationType==='add'){ this.setState({ files }, () => { if (this.state.files.length === 4) { this.setState({ addImg: false }) } }) } if (operationType === 'remove'){ this.state.files.splice(index, 1); this.setState({ files: this.state.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 ( *供求类型: {this.state.demandingSupplyCateSelected} * * * *联系地址: *需求内容: 需求图片: (最多4张) *状态: {this.state.demandingSupplyStateSelected} 发布 发布并新增 商品列表 ) } } export default SupplyDemand