index.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. </view>
  16. </template>
  17. <script>
  18. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  19. export default {
  20. mixins: [MescrollMixin],
  21. data() {
  22. return {
  23. noticeList:[],
  24. unreadList:[]
  25. };
  26. },
  27. onShow() {
  28. this.getList()
  29. },
  30. methods:{
  31. getList(){
  32. var that = this
  33. uni.showLoading({
  34. title: '数据加载中'
  35. })
  36. this.$request.baseRequest('admin.tourism.noticeMessageInfo', 'list',{
  37. receiveId:uni.getStorageSync("userInfo").id,
  38. }, failres => {
  39. uni.showToast({
  40. icon:"none",
  41. title: failres.errmsg,
  42. duration: 3000
  43. });
  44. uni.hideLoading()
  45. }).then(res => {
  46. let curPageLen = res.data.items.length;
  47. let totalPage = res.data.total;
  48. this.noticeList=res.data.items
  49. if(this.noticeList.length>0){
  50. var data=this.noticeList.filter((item)=>{return item.newsFlag==0})
  51. this.unreadList=data
  52. if(this.unreadList.length>0){
  53. for(var i=0;i<this.unreadList.length;i++){
  54. if(this.unreadList[i].newsFlag==0){
  55. this.unreadList[i].newsFlag=1
  56. this.$request.baseRequest('admin.tourism.noticeMessageInfo', 'update',{
  57. noticeMessageInfo:JSON.stringify(this.unreadList[i]),
  58. }, failres => {
  59. uni.showToast({
  60. icon:"none",
  61. title: failres.errmsg,
  62. duration: 3000
  63. });
  64. uni.hideLoading()
  65. }).then(res => {})
  66. }
  67. }
  68. }
  69. }
  70. uni.hideLoading()
  71. })
  72. },
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .notice-wrap{
  78. background:#fff;
  79. padding:20rpx;
  80. margin:10rpx;
  81. border-radius:20rpx;
  82. }
  83. .date{
  84. color:#CCCCCC;
  85. }
  86. .content{
  87. font-size:26rpx;
  88. color:#666;
  89. }
  90. </style>