import Taro, { Component } from '@tarojs/taro'
import { ScrollView } from '@tarojs/components'
import { Page, AtPage, AtPreview, AtPreviewItem, AtTitle, AtButton } from '@CUI'
import cgi from '../../../config/cgi.js'
import styles from './query_res.module.scss'
const sdk = Taro.getApp().sdk
export default class Index extends Page {
config = {
navigationBarTitleText: '查询结果'
}
state = {
page: 1,
formData: null,
list: null,
}
componentWillMount() {
console.log('手机端测试')
if (this.$router.params) {
this.setState({ formData: this.$router.params })
let params = this.$router.params
sdk.request({
url: cgi.publicService,
method: 'POST',
data: {
sessionId: "fujunyinid",
serviceId: "gwyDevolution",
taskId: params.taskId,
pageNo: "1",
department: params.department,
searchContent: params.inputValue
},
header: { 'content-type': 'application/json' },
}).then(res => {
if (res.responseBody.list.length === 0) {
Taro.showToast({
title: '没有相关数据',
icon: 'none',
duration: 2000
})
setTimeout(() => {
Taro.navigateBack(1)
}, 3000)
} else {
this.setState({ list: res.responseBody.list })
}
})
}
}
componentDidMount() { }
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
onScrollToLower(e) {
if (this.state.loading) return
this.setState({
loading: true
})
Taro.showLoading({
title: '加载中...',
mask: true
})
this.setState({ page: this.state.page += 1 })
sdk.request({
url: cgi.publicService,
method: 'POST',
data: {
sessionId: "fujunyinid",
serviceId: "gwyDevolution",
taskId: this.state.formData.taskId,
pageNo: this.state.page,
department: this.state.formData.department,
},
header: { 'content-type': 'application/json' },
}).then(res => {
let reslist = res.responseBody.list
if (reslist && reslist.length > 0) {
this.setState({
list: this.state.list.concat(reslist)
})
this.setState({
loading: false
})
} else {
Taro.showToast({
title: '没有更多数据了...',
icon: 'none',
duration: 2000
})
}
Taro.hideLoading()
})
}
render() {
const Threshold = 40
return (
<AtPage className={styles.test}>
<ScrollView
className={styles.ScollHight}
scrollY
lowerThreshold={Threshold}
onScrollToLower={this.onScrollToLower.bind(this)}
onScroll={this.onScroll}
>
<AtTitle>查询结果</AtTitle>
{
this.state.list && this.state.list.map((item) => {
return <AtPreview title='' actionText='' onActionClick={this.handleClick}>
<AtPreviewItem title='项目名称:' text={item.projectName} hasBorder />
<AtPreviewItem title='审批部门:' text={item.department} hasBorder />
{item.processingDecisions && <AtPreviewItem title='处理决定:' text={item.processingDecisions} />}
</AtPreview>
})
}
</ScrollView>
</AtPage>
)
}
}
react加载更多
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 下拉刷新的工具我用的是:react-native-pullrefresh-scrollview,上拉加载更多没找到...
- react-native列表FlatList下拉刷新上拉加载更多实现 具体代码懒得择了,这里只给出比官网文档全一点...
- react-native-page-listview 对ListView/FlatList的封装,可以很方便的分页...
- RN-ListViewLoadMorereact-native中处理ListView的下拉刷新和上拉加载更多 Re...
- 0、写在前面 用React Native也有一段时间了,新出来的加载列表控件FlatList也出来了,FlatLi...