notice.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view class="notice" :style="tabidx=='dbtz'?'padding-top:188rpx;':'padding-top:100rpx;'">
  3. <view class="pfixed" style="background: transparent;">
  4. <tab-list :tablist="tzlxlist" :height="height" :tabidx="tabidx" @getCheck="getCheck"></tab-list>
  5. </view>
  6. <view class="mt12">
  7. <wait-list type='xxtz' :datalist="list" :wtdt="wtdt" @getDetail="getDetail"></wait-list>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  13. import {getNoticeList} from "@/api/common.js"
  14. import {getDictionaryFn} from "@/api/mine/register.js"
  15. import waitList from "@/components/wait/list.vue"
  16. import tabList from '@/components/toptab/tab.vue'
  17. export default{
  18. components:{tabList,waitList},
  19. data(){
  20. return{
  21. tzlxlist:[],
  22. tabidx:'',
  23. height:100,
  24. scroflag:false,
  25. list:[],
  26. pageSize: 10,
  27. pageNum: 1,
  28. reachflag: true,
  29. wtdt:'',
  30. userId:this.$store.state.user.userId,
  31. }
  32. },
  33. onPageScroll(e) {
  34. var scrollTop = Number(e.scrollTop);
  35. // var listTop=Number(this.listTop)-Number(this.nvaHeight)
  36. if(scrollTop>2){
  37. this.scroflag=true
  38. }else{
  39. this.scroflag=false
  40. }
  41. },
  42. // 上拉触底加载更多触发事件
  43. onReachBottom() {
  44. if (this.reachflag) {
  45. this.pageNum++
  46. this.getDataFn()
  47. }
  48. },
  49. onLoad(e) {
  50. if(e.type){
  51. this.tabidx=e.type
  52. }
  53. this.init();
  54. },
  55. methods:{
  56. checkPermi, checkRole,
  57. init(){
  58. // 通知类型
  59. getDictionaryFn('sys_notice_type').then(res=>{
  60. if(res.code==200){
  61. if(res.data&&res.data.length>0){
  62. this.tabidx=res.data[0].dictValue;
  63. this.getDataFn()
  64. this.tzlxlist = res.data.map(v => {
  65. return {
  66. tit: v.dictLabel,
  67. val: v.dictValue
  68. }
  69. })
  70. }
  71. }
  72. })
  73. },
  74. getCheck(val){
  75. this.tabidx=val;
  76. this.getrefreshData()
  77. },
  78. getrefreshData(){
  79. this.pageNum=1;
  80. this.list=[];
  81. this.reachflag=true;
  82. this.getDataFn()
  83. },
  84. getDetail(e){
  85. this.$tab.navigateTo("/pages/index/noticedetail?type="+this.tabidx+'&id='+e)
  86. },
  87. getDataFn(){
  88. var params={
  89. pageSize:this.pageSize,
  90. pageNum: this.pageNum,
  91. }
  92. params.noticeType=this.tabidx
  93. getNoticeList(params).then(res=>{
  94. if(res.code==200){
  95. if (res.rows.length < this.pageSize) {
  96. this.reachflag = false
  97. this.wtdt = '到底了~';
  98. } else {
  99. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  100. if (num < res.total) {
  101. this.reachflag = true
  102. this.wtdt = ''
  103. } else {
  104. this.reachflag = false
  105. this.wtdt = '到底了~';
  106. }
  107. }
  108. if (this.pageNum == 1) {
  109. this.list = res.rows;
  110. } else {
  111. this.list = this.list.concat(res.rows)
  112. }
  113. }else{
  114. this.$toast(res.msg)
  115. }
  116. })
  117. },
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .notice /deep/ uni-picker{flex: 1;}
  123. </style>