index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. noticeList:[],
  66. unreadList:[]
  67. };
  68. },
  69. onShow() {
  70. this.getList()
  71. },
  72. methods:{
  73. tabbarChange(e){
  74. console.log(e)
  75. if(e=='team'){
  76. uni.navigateTo({
  77. url:'/pageA/enter/enter'
  78. })
  79. }else if(e=='user'){
  80. uni.navigateTo({
  81. url:'/pageA/my/my'
  82. })
  83. }
  84. // name => tabbarCheck = name
  85. },
  86. getList(){
  87. var that = this
  88. uni.showLoading({
  89. title: '数据加载中'
  90. })
  91. this.$request.baseRequest('admin.tourism.noticeMessageInfo', 'list',{
  92. receiveId:uni.getStorageSync("userInfo").id,
  93. }, failres => {
  94. uni.showToast({
  95. icon:"none",
  96. title: failres.errmsg,
  97. duration: 3000
  98. });
  99. uni.hideLoading()
  100. }).then(res => {
  101. let curPageLen = res.data.items.length;
  102. let totalPage = res.data.total;
  103. this.noticeList=res.data.items
  104. if(this.noticeList.length>0){
  105. var data=this.noticeList.filter((item)=>{return item.newsFlag==0})
  106. this.unreadList=data
  107. if(this.unreadList.length>0){
  108. for(var i=0;i<this.unreadList.length;i++){
  109. if(this.unreadList[i].newsFlag==0){
  110. this.unreadList[i].newsFlag=1
  111. this.$request.baseRequest('admin.tourism.noticeMessageInfo', 'update',{
  112. noticeMessageInfo:JSON.stringify(this.unreadList[i]),
  113. }, failres => {
  114. uni.showToast({
  115. icon:"none",
  116. title: failres.errmsg,
  117. duration: 3000
  118. });
  119. uni.hideLoading()
  120. }).then(res => {})
  121. }
  122. }
  123. }
  124. }
  125. uni.hideLoading()
  126. })
  127. },
  128. }
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .notice-wrap{
  133. background:#fff;
  134. padding:20rpx;
  135. margin:10rpx;
  136. border-radius:20rpx;
  137. }
  138. .date{
  139. color:#CCCCCC;
  140. }
  141. .content{
  142. font-size:26rpx;
  143. color:#666;
  144. }
  145. </style>