|
|
<template>
|
|
|
<template>
|
|
|
<LayoutApp :show-back="true" :title="title">
|
|
|
<Scroll
|
|
|
ref="scroll"
|
|
|
v-if="noticeList.length"
|
|
|
:scroll-events="['scroll-end','scroll']"
|
|
|
@scroll-end="fetchList"
|
|
|
<Scroll
|
|
|
ref="scroll"
|
|
|
v-if="noticeList.length"
|
|
|
:scroll-events="['scroll-end','scroll']"
|
|
|
@scroll-end="fetchList"
|
|
|
>
|
|
|
<NoticeItem v-for="(item, index) in noticeList" :key="index" :data="item"></NoticeItem>
|
|
|
</Scroll>
|
...
|
...
|
@@ -15,15 +15,16 @@ |
|
|
<script>
|
|
|
import { createNamespacedHelpers } from 'vuex';
|
|
|
|
|
|
const { mapState, mapActions} = createNamespacedHelpers('notice');
|
|
|
const { mapState, mapActions } = createNamespacedHelpers('notice');
|
|
|
import NoticeItem from './components/noticeItem';
|
|
|
import UfoNoItem from '../../../components/ufo-no-item'
|
|
|
import UfoNoItem from '../../../components/ufo-no-item';
|
|
|
|
|
|
import {
|
|
|
Style,
|
|
|
Scroll,
|
|
|
RecycleList
|
|
|
Style,
|
|
|
Scroll,
|
|
|
RecycleList
|
|
|
} from 'cube-ui';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
NoticeItem,
|
...
|
...
|
@@ -32,35 +33,33 @@ export default { |
|
|
UfoNoItem,
|
|
|
RecycleList
|
|
|
},
|
|
|
data(){
|
|
|
data() {
|
|
|
return {
|
|
|
title: '公告',
|
|
|
data: {},
|
|
|
scrolling: false,
|
|
|
scrollOption: {
|
|
|
pullUpLoad:true,
|
|
|
pullUpLoad: true,
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
created(){
|
|
|
created() {
|
|
|
this.fetchList();
|
|
|
// this.fetchNoticeList();
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
...mapState(['noticeList','fetchNoticePage','isMore','isShowEmpty']),
|
|
|
...mapState(['noticeList', 'fetchNoticePage', 'isMore', 'isShowEmpty']),
|
|
|
},
|
|
|
methods:{
|
|
|
methods: {
|
|
|
...mapActions(['fetchNoticeList']),
|
|
|
onScroll(){
|
|
|
console.log('onScroll')
|
|
|
onScroll() {
|
|
|
this.scrolling = true;
|
|
|
this._scTimer && clearTimeout(this._scTimer);
|
|
|
this._scTimer = setTimeout(() => {
|
|
|
this.scrolling = false;
|
|
|
}, 400);
|
|
|
},
|
|
|
scroll({ y }) {
|
|
|
scroll({ y }) {
|
|
|
const height = this.$refs.banner.$el.offsetHeight + this.$refs.header.offsetHeight;
|
|
|
|
|
|
if (-y >= height) {
|
...
|
...
|
@@ -69,20 +68,20 @@ export default { |
|
|
this.fixed = false;
|
|
|
}
|
|
|
},
|
|
|
fetchList(){
|
|
|
console.log('fetchList:'+this.isMore)
|
|
|
if (!this.isMore) {
|
|
|
return;
|
|
|
}
|
|
|
console.log('fetchList:'+this.noMore)
|
|
|
this.fetchNoticeList().then(res => {
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.scroll.forceUpdate(true);
|
|
|
});
|
|
|
fetchList() {
|
|
|
console.log('fetchList:' + this.isMore);
|
|
|
if (!this.isMore) {
|
|
|
return;
|
|
|
}
|
|
|
console.log('fetchList:' + this.noMore);
|
|
|
this.fetchNoticeList().then(res => {
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.scroll.forceUpdate(true);
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
async onPullingUp(){
|
|
|
console.log('onPullingUp:'+this.isMore)
|
|
|
async onPullingUp() {
|
|
|
console.log('onPullingUp:' + this.isMore);
|
|
|
await this.fetchList();
|
|
|
},
|
|
|
|
...
|
...
|
@@ -95,6 +94,6 @@ export default { |
|
|
<style scoped>
|
|
|
|
|
|
.scroll-content {
|
|
|
height: 500px;
|
|
|
height: 500px;
|
|
|
}
|
|
|
</style> |
|
|
\ No newline at end of file |
|
|
</style> |
...
|
...
|
|