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: '查詢(xún)結(jié)果'
}
state = {
page: 1,
formData: null,
list: null,
}
componentWillMount() {
console.log('手機(jī)端測(cè)試')
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: '沒(méi)有相關(guān)數(shù)據(jù)',
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: '沒(méi)有更多數(shù)據(jù)了...',
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>查詢(xún)結(jié)果</AtTitle>
{
this.state.list && this.state.list.map((item) => {
return <AtPreview title='' actionText='' onActionClick={this.handleClick}>
<AtPreviewItem title='項(xiàng)目名稱(chēng):' text={item.projectName} hasBorder />
<AtPreviewItem title='審批部門(mén):' text={item.department} hasBorder />
{item.processingDecisions && <AtPreviewItem title='處理決定:' text={item.processingDecisions} />}
</AtPreview>
})
}
</ScrollView>
</AtPage>
)
}
}
react加載更多
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 下拉刷新的工具我用的是:react-native-pullrefresh-scrollview,上拉加載更多沒(méi)找到...
- react-native列表FlatList下拉刷新上拉加載更多實(shí)現(xiàn) 具體代碼懶得擇了,這里只給出比官網(wǎng)文檔全一點(diǎn)...
- react-native-page-listview 對(duì)ListView/FlatList的封裝,可以很方便的分頁(yè)...
- RN-ListViewLoadMorereact-native中處理ListView的下拉刷新和上拉加載更多 Re...
- 0、寫(xiě)在前面 用React Native也有一段時(shí)間了,新出來(lái)的加載列表控件FlatList也出來(lái)了,F(xiàn)latLi...