123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <template>
- <view class="box">
- <view class="flex1 overh boxtop">
- <tablist :tablist="tablist" :tabval="tabval" @getCheck="getCheck"></tablist>
- </view>
- <view class="stepbox" >
- <box-list :datainfo="list" type="notice" :wtdt="wtdt" @getDetail="getDetail"></box-list>
- </view>
- <loading></loading>
- </view>
- </template>
- <script>
- import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
- import {getDictionaryFn} from "@/api/mine/register.js";
- import {getNoticeList} from "@/api/common.js"
- import tablist from '@/components/tabs/index.vue'
- import boxList from "@/news/components/box/list.vue"
- export default {
- components:{tablist,boxList},
- data(){
- return{
- list:[],
- pageSize: 10,
- pageNum: 1,
- reachflag: true,
- tabval:'',
- tablist:[],
- wtdt:'',
- tzList:[],
- }
- },
- onShow() {
-
- },
- onLoad: function() {
- this.init();
- },
- // 上拉触底加载更多触发事件
- onReachBottom() {
- if (this.reachflag) {
- this.pageNum++
- this.getDataFn()
- }
- },
- methods:{
- checkPermi,checkRole,
- init(){
- //通知类型
- getDictionaryFn('sys_notice_type').then(res => {
- if (res.code == 200) {
- this.tablist = res.data.map(v => {
- this.tabval=res.data[0].dictValue
- return {
- dictLabel: v.dictLabel,
- dictValue: v.dictValue
- }
- })
- this.getDataFn()
- }
- })
- },
- getCheck(val){
- this.tabval=val;
- this.getrefreshData()
- },
- getrefreshData(){
- this.pageNum=1;
- this.list=[];
- this.reachflag=true;
- this.getDataFn()
- },
- getDetail(ite){
- var id=ite.noticeId;
- if(ite.noticeType==3){
- this.$tab.navigateTo(`/news/pages/notice/detail?id=${id}&type=`+ite.noticeType)
- }else{
- this.$tab.navigateTo(`/news/pages/notice/tzdetail?id=${id}&type=`+ite.noticeType)
- }
-
- },
- getDataFn(){
- var params={
- pageSize:this.pageSize,
- pageNum: this.pageNum,
- }
- params.noticeType=this.tabval
- getNoticeList(params).then(res=>{
- if(res.code==200){
- if (res.rows.length < this.pageSize) {
- this.reachflag = false
- this.wtdt = '到底了~';
- } else {
- var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
- if (num < res.total) {
- this.reachflag = true
- this.wtdt = ''
- } else {
- this.reachflag = false
- this.wtdt = '到底了~';
- }
- }
- if (this.pageNum == 1) {
- this.list = res.rows;
- } else {
- this.list = this.list.concat(res.rows)
- }
- }else{
- this.$toast(res.msg)
- }
- })
-
- },
-
-
-
- }
- }
- </script>
- <style lang="scss" scoped>
- .boxtop{padding: 18rpx 0 0;background-color: #ffffff;
- position: fixed;left: 0;top: 0;right: 0;z-index: 2;
- }
- .box{padding-top: 100rpx;}
- .stepbox{padding: 18rpx 24rpx 0;}
- </style>
|