notice.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view>
  3. <!-- <mescroll-body :up="upOption" ref="mescrollRef" @init="mescrollInit" @up="upCallback" @down="downCallback"> -->
  4. <view class='notice-wrap' v-for='item in noticeList'>
  5. <view class="flex justify-space-between">
  6. <view style='width:100px;margin:10rpx 0;' class='flex justify-space-between'>
  7. <u--image :showLoading="true" src="/static/imgs/card/news.png" width="52rpx" height="52rpx"></u--image>
  8. <view>{{item.newsTitle}}</view>
  9. </view>
  10. <view class='date'>{{parseTime(item.gmtCreate)}}</view>
  11. </view>
  12. <view class='content'>{{item.newsContent}}</view>
  13. </view>
  14. <!-- </mescroll-body> -->
  15. <u-toast ref="uToast"></u-toast>
  16. </view>
  17. </template>
  18. <script>
  19. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  20. export default {
  21. mixins: [MescrollMixin],
  22. data() {
  23. return {
  24. noticeList:[],
  25. unreadList:[]
  26. };
  27. },
  28. onShow() {
  29. this.getList()
  30. },
  31. methods:{
  32. getList(){
  33. var that = this
  34. uni.showLoading({
  35. title: '数据加载中'
  36. })
  37. this.$request.baseRequest('admin.unimall.cardNewsInfo', 'list',{
  38. receiveId:uni.getStorageSync("userInfo").id,
  39. }, failres => {
  40. uni.showToast({
  41. icon:"none",
  42. title: failres.errmsg,
  43. duration: 3000
  44. });
  45. uni.hideLoading()
  46. }).then(res => {
  47. let curPageLen = res.data.items.length;
  48. let totalPage = res.data.total;
  49. this.noticeList=res.data.items
  50. if(this.noticeList.length>0){
  51. var data=this.noticeList.filter((item)=>{return item.newsFlag==0})
  52. this.unreadList=data
  53. if(this.unreadList.length>0){
  54. for(var i=0;i<this.unreadList.length;i++){
  55. if(this.unreadList[i].newsFlag==0){
  56. this.unreadList[i].newsFlag=1
  57. this.$request.baseRequest('admin.unimall.cardNewsInfo', 'update',{
  58. cardNewsInfo:JSON.stringify(this.unreadList[i]),
  59. }, failres => {
  60. uni.showToast({
  61. icon:"none",
  62. title: failres.errmsg,
  63. duration: 3000
  64. });
  65. uni.hideLoading()
  66. }).then(res => {})
  67. }
  68. }
  69. }
  70. }
  71. uni.hideLoading()
  72. })
  73. },
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. .notice-wrap{
  79. background:#fff;
  80. padding:20rpx;
  81. margin:10rpx;
  82. border-radius:20rpx;
  83. }
  84. .date{
  85. color:#CCCCCC;
  86. }
  87. .content{
  88. font-size:26rpx;
  89. color:#666;
  90. }
  91. </style>