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

226 lines
8.8 KiB
JavaScript
Raw Normal View History

import Taro, { Component } from '@tarojs/taro'
2018-12-11 17:34:06 +08:00
import { View, Text } from '@tarojs/components'
import { AtInput, AtButton, Picker,AtIcon } from 'taro-ui'
2018-12-14 17:10:23 +08:00
import URL from '../../serviceAPI.config'
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import searchBarComponent from '../../component/searchBarComponent/searchBarComponent'
import './mySupplyDemand.scss'
console.log('hi')
class MySupplyDemand extends Component {
config = {
navigationBarTitleText: '我的供求'
}
constructor() {
super(...arguments)
this.state = {
2018-12-11 17:34:06 +08:00
demandSupplyCate: ['全部','需求', '供应', '人才'],
demandSupplyCateSelected: '全部',
demandSupplyState: ['全部','上架', '下架'],
demandSupplyStatesSelected: '全部',
title:'',
startDateSel: '2018-04-22',
endDateSel: '2018-04-22',
}
}
2018-12-14 17:10:23 +08:00
//MySupplyDemand
getMySupplyDemand({ curr_page=1, page_count=20}) {
Taro.request({
url: URL.MySupplyDemand,
method: 'POST',
dataType: 'json',
data: {
curr_page: curr_page,
page_count: page_count
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(res => {
2018-12-18 17:37:23 +08:00
console.log(res) // ------------------------------------------- to be continue----
2018-12-14 17:10:23 +08:00
console.log('个人供求=》暂时无数据, 后台需要权限验证')
})
}
2018-12-11 17:34:06 +08:00
//修改供求类型
demSupplyCateChange = e => {
this.setState({
2018-12-11 17:34:06 +08:00
demandSupplyCateSelected: this.state.demandSupplyCate[e.detail.value]
})
}
2018-12-11 17:34:06 +08:00
// 修改供求状态
demSupplyStateChange = e => {
this.setState({
2018-12-11 17:34:06 +08:00
demandSupplyStatesSelected: this.state.demandSupplyState[e.detail.value]
})
}
2018-12-11 17:34:06 +08:00
titleChange(event){
this.setState({title:event})
}
// 修改开始日期
onStartDateChange = e => {
this.setState({
startDateSel: e.detail.value
})
}
// 修改结束日期
onEndDateChange = e => {
this.setState({
2018-12-11 17:34:06 +08:00
endDateSel: e.detail.value
})
}
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
}
2018-12-14 17:10:23 +08:00
componentDidMount () {
this.getMySupplyDemand({})
}
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
render() {
return (
<View className='mySupplyDemand'>
<searchBarComponent></searchBarComponent>
2018-12-11 17:34:06 +08:00
{/* 供求类型 */}
<View className='page-section'>
<View>
2018-12-11 17:34:06 +08:00
<Picker mode='selector' range={this.state.demandSupplyCate} onChange={this.demSupplyCateChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
2018-12-11 17:34:06 +08:00
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandSupplyCateSelected}</Text>
</View>
</View>
</Picker>
</View>
</View>
2018-12-11 17:34:06 +08:00
{/* 供求状态 */}
<View className='page-section'>
<View>
2018-12-11 17:34:06 +08:00
<Picker mode='selector' range={this.state.demandSupplyState} onChange={this.demSupplyStateChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
2018-12-11 17:34:06 +08:00
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandSupplyStatesSelected}</Text>
</View>
</View>
</Picker>
</View>
</View>
2018-12-11 17:34:06 +08:00
{/* 供求标题 */}
<View className='input-box'>
<Text className='require'>*</Text>
<AtInput
name='value'
title='供求标题:'
placeholder='供求标题·'
type='text'
2018-12-11 17:34:06 +08:00
value={this.state.title}
onChange={this.titleChange.bind(this)}
/>
</View>
2018-12-11 17:34:06 +08:00
{/* 开始和结束日期 */}
<View className='page-section'>
<View className='picker-box'>
2018-12-11 17:34:06 +08:00
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
<View className='picker'>
<View className='title-box'>
2018-12-11 17:34:06 +08:00
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.startDateSel}</Text>
</View>
</View>
</Picker>
2018-12-11 17:34:06 +08:00
<Picker className='picker-container' mode='date' onChange={this.onEndDateChange}>
<View className='picker'>
<View className='title-box'>
2018-12-11 17:34:06 +08:00
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.endDateSel}</Text>
</View>
</View>
</Picker>
</View>
</View>
<View className='button-box'>
<View className='button'>
<AtButton type='primary' size='small'>
<AtIcon value='search' size='12' color='white'></AtIcon>
搜索</AtButton>
</View>
<View className='button'>
<AtButton type='primary' className='button-a' size='small'>
<AtIcon value='add' size='12' color='white'></AtIcon>
新增</AtButton>
</View>
</View>
<View className='total-count'>一共<Text className='number'>20</Text> </View>
2018-12-11 17:34:06 +08:00
{/* 我的供求信息 */}
<View className='info-box'>
<View className='info-container'>
<View className='type'>
<Text className='title'>需求类型</Text>
<Text className='info'>1</Text>
</View>
<View className='demand-title'>
<Text className='title'>需求标题</Text>
<Text className='info'>1</Text>
</View>
<View className='contact-name'>
<Text className='title'>联系人</Text>
<Text className='info'>1</Text>
</View>
<View className='contact-number'>
<Text className='title'>电话号码</Text>
<Text className='info'>1</Text>
</View>
<View className='demand-status'>
<Text className='title'>需求状态</Text>
<Text className='info'></Text>
</View>
<View className='update-time'>
<Text className='title'>更新时间</Text>
<Text className='info'>1</Text>
</View>
<View className='info-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' className='button-a' size='small'>删除</AtButton>
</View>
</View>
</View>
</View>
<copyrightComponent></copyrightComponent>
</View>
)
}
}
export default MySupplyDemand