notice.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. console.log('res+++++', failres.errmsg)
  41. uni.showToast({
  42. icon:"none",
  43. title: failres.errmsg,
  44. duration: 3000
  45. });
  46. uni.hideLoading()
  47. }).then(res => {
  48. console.log(res)
  49. let curPageLen = res.data.items.length;
  50. let totalPage = res.data.total;
  51. this.noticeList=res.data.items
  52. if(this.noticeList.length>0){
  53. var data=this.noticeList.filter((item)=>{return item.newsFlag==0})
  54. this.unreadList=data
  55. if(this.unreadList.length>0){
  56. for(var i=0;i<this.unreadList.length;i++){
  57. if(this.unreadList[i].newsFlag==0){
  58. this.unreadList[i].newsFlag=1
  59. this.$request.baseRequest('admin.unimall.cardNewsInfo', 'update',{
  60. cardNewsInfo:JSON.stringify(this.unreadList[i]),
  61. }, failres => {
  62. console.log('res+++++', failres.errmsg)
  63. uni.showToast({
  64. icon:"none",
  65. title: failres.errmsg,
  66. duration: 3000
  67. });
  68. uni.hideLoading()
  69. }).then(res => {})
  70. }
  71. }
  72. }
  73. }
  74. uni.hideLoading()
  75. })
  76. },
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .notice-wrap{
  82. background:#fff;
  83. padding:20rpx;
  84. margin:10rpx;
  85. border-radius:20rpx;
  86. }
  87. .date{
  88. color:#CCCCCC;
  89. }
  90. .content{
  91. font-size:26rpx;
  92. color:#666;
  93. }
  94. </style>