268 lines
6.3 KiB
Vue
268 lines
6.3 KiB
Vue
<template>
|
|
<view class="content">
|
|
|
|
<div class="massage-tab uni-flex">
|
|
<div class="massage-unit" :class="{'active':currentTab===0}" @tap="currentTab=0">
|
|
我的收文
|
|
</div>
|
|
<div class="massage-unit" :class="{'active':currentTab===1}" @tap="currentTab=1">
|
|
我的发文
|
|
</div>
|
|
</div>
|
|
<view style="flex: 1;width: 750upx;overflow: hidden;">
|
|
<scroll-view v-show="currentTab===0" enableBackToTop="true" scroll-y style="height: 100%;" @scrolltolower="loadMore()">
|
|
<view v-if="reciveList.length>0">
|
|
|
|
<list-unit v-for="(item,index) in reciveList" :key="index" :item="item" :i="index" @goDetail="goDetail"></list-unit>
|
|
|
|
</view>
|
|
<view v-else-if="pageData.isLoading===false" >
|
|
<noFound :nodata="reciveList.length>0 ? false : true"/>
|
|
</view>
|
|
<view class="load-more" v-if="reciveList.length>0">
|
|
<text>{{!pageData.isEnd[0] ? '正在加载,请稍后...':'——— 我是有底线的 ———'}}</text>
|
|
</view>
|
|
</scroll-view>
|
|
<scroll-view v-show="currentTab===1" enableBackToTop="true" scroll-y style="height: 100%;" @scrolltolower="loadMore()">
|
|
|
|
<view v-if="sendList.length>0">
|
|
|
|
<list-unit v-for="(item,index) in sendList" :key="index" :item="item" :i="index" @goDetail="goDetail" type="1"></list-unit>
|
|
|
|
</view>
|
|
<view v-else-if="pageData.isLoading===false" >
|
|
<noFound :nodata="sendList.length>0 ? false : true"/>
|
|
</view>
|
|
<view class="load-more" v-if="sendList.length>0">
|
|
<text>{{!pageData.isEnd[1] ? '正在加载,请稍后...':'——— 我是有底线的 ———'}}</text>
|
|
</view>
|
|
</scroll-view>
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import ListUnit from './components/listUnit.vue'
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
pageData: {
|
|
pageIndex:1,
|
|
pageSize:10,
|
|
sendPageIndex:1,
|
|
sendPageSize:10,
|
|
isEnd: [false,false],
|
|
isLoading: true
|
|
},
|
|
currentTab: 0,
|
|
reciveList: [], // 我的收文列表
|
|
sendList: [], // 我的发文列表
|
|
|
|
}
|
|
},
|
|
components:{
|
|
ListUnit
|
|
},
|
|
|
|
methods: {
|
|
getList() { // 获取公文列表 我的收文
|
|
let _this = this
|
|
|
|
_this.$request.$get('getDocumentList',{
|
|
|
|
pageIndex: this.pageData.pageIndex,
|
|
pageSize: this.pageData.pageSize,
|
|
documentListType: 1000, // 列表类型 我的收文:1000,我的发文:2000
|
|
|
|
}).then(res => {
|
|
|
|
if(!res.ResultCode ||res.ResultCode!='100'){
|
|
|
|
_this.reciveList = []
|
|
}else{
|
|
let list = res.Data.List
|
|
if (list.length > 0) {
|
|
if( this.pageData.pageIndex==1 ) {
|
|
|
|
_this.reciveList = list
|
|
|
|
}else{
|
|
_this.reciveList = _this.reciveList.concat(list)
|
|
}
|
|
|
|
}
|
|
|
|
if (list.length < _this.pageData.pageSize) { // 返回条数小于每页条数
|
|
_this.pageData.isEnd[0] = true
|
|
}
|
|
// _this.$forceUpdate()
|
|
}
|
|
uni.hideLoading()
|
|
setTimeout(function(){
|
|
_this.pageData.isLoading = false
|
|
},500)
|
|
|
|
})
|
|
},
|
|
getSendList() {
|
|
let _this = this
|
|
|
|
_this.$request.$get('getDocumentList',{
|
|
|
|
pageIndex: this.pageData.sendPageIndex,
|
|
pageSize: this.pageData.sendPageSize,
|
|
documentListType: 2000
|
|
}).then(res => {
|
|
|
|
if(!res.ResultCode ||res.ResultCode!='100'){
|
|
|
|
_this.sendList = []
|
|
}else{
|
|
let list = res.Data.List
|
|
if (list.length > 0) {
|
|
if( this.pageData.sendPageIndex==1 ) {
|
|
|
|
_this.sendList = list
|
|
|
|
}else{
|
|
_this.sendList = _this.sendList.concat(list)
|
|
}
|
|
|
|
}
|
|
|
|
if (list.length < _this.pageData.sendPageSize) { // 返回条数小于每页条数
|
|
_this.pageData.isEnd[1] = true
|
|
}
|
|
// _this.$forceUpdate()
|
|
}
|
|
uni.hideLoading()
|
|
setTimeout(function(){
|
|
_this.pageData.isLoading = false
|
|
},500)
|
|
|
|
})
|
|
},
|
|
loadMore() {
|
|
|
|
if(!this.pageData.isEnd[this.currentTab]) {
|
|
if (this.currentTab===0) { // 当前为收文
|
|
this.pageData.pageIndex += 1
|
|
this.getList()
|
|
}else{
|
|
this.pageData.sendPageIndex += 1
|
|
this.getSendList()
|
|
}
|
|
|
|
}
|
|
},
|
|
downFresh() { // 下拉刷新
|
|
let _this = this
|
|
if (_this.currentTab===0) { // 当前为收文
|
|
|
|
_this.pageData.pageIndex = 1
|
|
_this.getList()
|
|
// _this.$forceUpdate()
|
|
} else { // 当前为异常数据
|
|
|
|
|
|
_this.pageData.sendPageIndex = 1
|
|
_this.getSendList()
|
|
// _this.$forceUpdate()
|
|
}
|
|
},
|
|
goDetail(item){
|
|
this.$util.toNextRoute('navigateTo', '/pages/officialDocManagement/detail?id='+item.DOCUMENT_ID+'&type=' + (this.currentTab===0 ? '1000': '2000')+'&isread='+item.ISREAD)
|
|
// uni.navigateTo({
|
|
// url: '/pages/officialDocManagement/detail?id='+item.DOCUMENT_ID+'&type=' + (this.currentTab===0 ? '1000': '2000')+'&isread='+item.ISREAD
|
|
// })
|
|
}
|
|
},
|
|
onPullDownRefresh() {
|
|
uni.showLoading({
|
|
title:'正在加载'
|
|
})
|
|
this.pageData.pageIndex = 1
|
|
this.pageData.isEnd = [false,false]
|
|
this.getList()
|
|
this.pageData.sendPageIndex = 1
|
|
this.getSendList()
|
|
setTimeout(function() {
|
|
uni.stopPullDownRefresh()
|
|
}, 1000)
|
|
},
|
|
onReachBottom(){
|
|
this.loadMore()
|
|
},
|
|
onLoad() {
|
|
let _this = this
|
|
uni.showLoading({
|
|
title:'正在加载'
|
|
})
|
|
this.pageData.isLoading = true
|
|
this.getList()
|
|
this.getSendList()
|
|
|
|
uni.$on('needrefresh', function (data){
|
|
if(data) {
|
|
uni.showLoading({
|
|
title:'正在加载'
|
|
})
|
|
|
|
_this.pageData.pageIndex = 1
|
|
_this.getList()
|
|
_this.pageData.isEnd = [false,false]
|
|
_this.pageData.sendPageIndex = 1
|
|
_this.getSendList()
|
|
|
|
}
|
|
});
|
|
},
|
|
onShow() {
|
|
|
|
},
|
|
onUnload() {
|
|
this.$util.addUserBehavior()
|
|
uni.$off('needrefresh');
|
|
},
|
|
onHide() {
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden;
|
|
height: 100%;
|
|
width: 750upx;
|
|
}
|
|
.massage-tab {
|
|
background-color: #fff;
|
|
/* height: 80upx; */
|
|
padding: 14upx 24upx 24upx 24upx;
|
|
}
|
|
.massage-unit {
|
|
border: 1upx solid #E8EBED;
|
|
height: 60upx;
|
|
width: 160upx;
|
|
border-radius: 8upx;
|
|
text-align: center;
|
|
line-height: 58upx;
|
|
font-size: 24upx;
|
|
}
|
|
.massage-unit+.massage-unit {
|
|
margin-left: 40upx;
|
|
}
|
|
.massage-unit.active {
|
|
background-color: #E6EDF6;
|
|
color: #5191E9;
|
|
border-color: #E6EDF6;
|
|
}
|
|
</style>
|