list.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import Taro, { Component } from '@tarojs/taro'
  2. import { View, Input, Picker, ScrollView, Button } from '@tarojs/components'
  3. import { Loading } from '@components'
  4. import { connect } from '@tarojs/redux'
  5. import * as actions from '@actions/list'
  6. // import { dispatchCartNum } from '@actions/list'
  7. import ItemList from './itemlist'
  8. import { getWindowHeight } from '@utils/style'
  9. import './list.scss'
  10. // @connect(state => state.home, { ...actions, })
  11. class List extends Component {
  12. config = {
  13. navigationBarTitleText: '报告列表'
  14. }
  15. state = {
  16. loaded: false,
  17. loading: false,
  18. lastItemId: 0,
  19. hasMore: true,
  20. selectorChecked: { id: 0, key: "按报告类型", value: 'title' },
  21. selector: [{ id: 0, key: "按报告类型", value: 'title' },
  22. { id: 1, key: "按企业名称", value: 'companyName' },
  23. { id: 2, key: "按项目名称", value: 'reportName' },
  24. { id: 3, key: "按关键词", value: 'keyword' },],
  25. keyword: "",
  26. }
  27. componentDidMount() {
  28. }
  29. // field:this.state.selectorChecked.value
  30. onChange = e => {
  31. this.setState({
  32. selectorChecked: this.state.selector[e.detail.value],
  33. })
  34. }
  35. onInput(e) {
  36. this.setState({
  37. keyword: e.detail.value
  38. })
  39. }
  40. onSearch() {
  41. if (!this.state.keyword) {
  42. }
  43. }
  44. render() {
  45. // if (!this.state.loaded) {
  46. // return <Loading />
  47. // }
  48. const { } = this.props
  49. return (
  50. <View className='home'>
  51. <View className='home_head'>
  52. <Picker
  53. mode='selector'
  54. range={this.state.selector}
  55. rangeKey="key"
  56. value={this.state.selectorChecked.id}
  57. onChange={this.onChange}>
  58. <View className='picker'>
  59. {this.state.selectorChecked.key} ▼
  60. </View>
  61. </Picker>
  62. <Input className='input' type='text' placeholder='请输入关键词进行查询' onInput={this.onInput} />
  63. <View className='button'
  64. onClick={() => {
  65. }}
  66. >搜索</View>
  67. </View>
  68. <ScrollView
  69. scrollY
  70. className='home__wrap'
  71. onScrollToLower={() => { console.log("----滑到底部") }}
  72. style={{ height: (getWindowHeight().substring(0, getWindowHeight().length - 2) - 55) + "px" }}
  73. >
  74. <ItemList />
  75. </ScrollView>
  76. </View>
  77. )
  78. }
  79. }
  80. export default List