index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view>
  3. <view class='notice-wrap' v-for='item in noticeList'>
  4. <view class="flex justify-space-between">
  5. <view style='width:100px;margin:10rpx 0;' class='flex justify-space-between'>
  6. <u--image :showLoading="true" src="/static/image/enter/news.png" width="52rpx" height="52rpx"></u--image>
  7. <view>{{item.newsTitle}}</view>
  8. </view>
  9. <view class='date'>{{parseTime(item.gmtCreate)}}</view>
  10. </view>
  11. <view class='content'>{{item.newsContent}}</view>
  12. </view>
  13. <!-- </mescroll-body> -->
  14. <u-toast ref="uToast"></u-toast>
  15. <u-tabbar
  16. :value="tabbarCheck"
  17. @change="tabbarChange"
  18. activeColor="#5F7DE9"
  19. >
  20. <u-tabbar-item name="team" text="加入">
  21. <image
  22. class="u-page__item__slot-icon"
  23. slot="active-icon"
  24. src="@/static/image/nav-icon/antOutline-team Copy.png"
  25. ></image>
  26. <image
  27. class="u-page__item__slot-icon"
  28. slot="inactive-icon"
  29. src="@/static/image/nav-icon/antOutline-team.png"
  30. ></image>
  31. </u-tabbar-item>
  32. <u-tabbar-item name="notification" text="通知">
  33. <image
  34. class="u-page__item__slot-icon"
  35. slot="active-icon"
  36. src="@/static/image/nav-icon/md-notifications_none Copy.png"
  37. ></image>
  38. <image
  39. class="u-page__item__slot-icon"
  40. slot="inactive-icon"
  41. src="@/static/image/nav-icon/md-notifications_none.png"
  42. ></image>
  43. </u-tabbar-item>
  44. <u-tabbar-item name="user" text="我的">
  45. <image
  46. class="u-page__item__slot-icon"
  47. slot="active-icon"
  48. src="@/static/image/nav-icon/antOutline-user1 Copy.png"
  49. ></image>
  50. <image
  51. class="u-page__item__slot-icon"
  52. slot="inactive-icon"
  53. src="@/static/image/nav-icon/antOutline-user1.png"
  54. ></image>
  55. </u-tabbar-item>
  56. </u-tabbar>
  57. </view>
  58. </template>
  59. <script>
  60. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  61. export default {
  62. mixins: [MescrollMixin],
  63. data() {
  64. return {
  65. tabbarCheck:'notification',
  66. noticeList:[],
  67. unreadList:[]
  68. };
  69. },
  70. onShow() {
  71. this.getList()
  72. },
  73. methods:{
  74. tabbarChange(e){
  75. console.log(e)
  76. if(e=='team'){
  77. uni.navigateTo({
  78. url:'/pageA/enter/enter'
  79. })
  80. }else if(e=='user'){
  81. uni.navigateTo({
  82. url:'/pageA/my/my'
  83. })
  84. }
  85. // name => tabbarCheck = name
  86. },
  87. getList(){
  88. var that = this
  89. uni.showLoading({
  90. title: '数据加载中'
  91. })
  92. this.$request.baseRequest('admin.tourism.noticeMessageInfo', 'list',{
  93. receiveId:uni.getStorageSync("userInfo").id,
  94. }, failres => {
  95. uni.showToast({
  96. icon:"none",
  97. title: failres.errmsg,
  98. duration: 3000
  99. });
  100. uni.hideLoading()
  101. }).then(res => {
  102. let curPageLen = res.data.items.length;
  103. let totalPage = res.data.total;
  104. this.noticeList=res.data.items
  105. if(this.noticeList.length>0){
  106. var data=this.noticeList.filter((item)=>{return item.newsFlag==0})
  107. this.unreadList=data
  108. if(this.unreadList.length>0){
  109. for(var i=0;i<this.unreadList.length;i++){
  110. if(this.unreadList[i].newsFlag==0){
  111. this.unreadList[i].newsFlag=1
  112. this.$request.baseRequest('admin.tourism.noticeMessageInfo', 'update',{
  113. noticeMessageInfo:JSON.stringify(this.unreadList[i]),
  114. }, failres => {
  115. uni.showToast({
  116. icon:"none",
  117. title: failres.errmsg,
  118. duration: 3000
  119. });
  120. uni.hideLoading()
  121. }).then(res => {})
  122. }
  123. }
  124. }
  125. }
  126. uni.hideLoading()
  127. })
  128. },
  129. }
  130. }
  131. </script>
  132. <style lang="scss" scoped>
  133. .notice-wrap{
  134. background:#fff;
  135. padding:20rpx;
  136. margin:10rpx;
  137. border-radius:20rpx;
  138. }
  139. .date{
  140. color:#CCCCCC;
  141. }
  142. .content{
  143. font-size:26rpx;
  144. color:#666;
  145. }
  146. </style>