WechatOwnerService/pages/notice/index.vue
2024-11-19 22:27:10 +08:00

118 lines
2.8 KiB
Vue

<template>
<view class="user-container">
<block v-if="notices.length > 0">
<view class="cu-list menu" v-for="(notice, idx) in notices" :key="idx" :data-item="notice"
@click="gotoDetail(notice)">
<view class="cu-item arrow">
<view class="content padding-tb-sm">
<view>
<text class="cuIcon-notification text-cut text-green margin-right-xs"></text>
<view class="text-cut" style="width:220px">{{notice.title}}</view>
</view>
<view class="text-gray text-sm">
<text class="margin-right-xs">发布时间:</text> {{notice.timeStr}}
</view>
</view>
</view>
</view>
<uni-load-more :status="loadingStatus" :content-text="loadingContentText" />
</block>
<block v-else>
<view class="cu-list menu">
<view class="cu-item">
<view class="content">
<text class="cuIcon-notification text-grey"></text>
<text class="text-grey">暂无公告信息</text>
</view>
<view class="action">
</view>
</view>
</view>
</block>
</view>
</template>
<script>
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
/** index.js **/
import context from '../../lib/java110/Java110Context.js';
import {
getCommunityId
} from '../../api/community/communityApi.js';
const constant = context.constant; //获取app实例
//获取app实例
const app = getApp().globalData;
import {
queryNotices
} from '@/api/index/indexApi.js';
export default {
data() {
return {
communityId: "",
notices: [],
currPageIndex: 0,
pageSize: 10,
page: 1,
loadingStatus: 'loading',
loadingContentText: {
contentdown: '上拉加载更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
}
};
},
components: {
uniLoadMore
},
onLoad: function(options) {
let that = this;
context.onLoad(options);
that.communityId = getCommunityId();
that._loadNotices();
},
onShow: function() {
let that = this;
},
onReachBottom: function() {
if (this.loadingStatus == 'noMore') {
return;
}
this._loadApply();
},
methods: {
_loadNotices: function() {
this.loadingStatus = 'more';
let that = this;
queryNotices({
communityId: that.communityId,
page: that.page,
row: 10,
noticeTypeCd: '1000,1003',
clientType: 'H5'
}).then((_notices) => {
that.notices = that.notices.concat(_notices);
if (that.notices.length == res.data.total) {
that.loadingStatus = 'noMore';
return;
}
});
},
gotoDetail: function(_notice) {
let that = this;
this.vc.navigateTo({
url: "/pages/notice/detail/detail?noticeId=" + _notice.noticeId + "&communityId=" + that
.communityId
});
},
}
};
</script>
<style>
@import "./index.css";
.cu-list+.cu-list {
margin-top: 10px;
}
</style>