notice.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. this.$refs.uToast.show({
  42. type: 'error',
  43. message: failres.errmsg,
  44. })
  45. uni.hideLoading()
  46. }).then(res => {
  47. console.log(res)
  48. let curPageLen = res.data.items.length;
  49. let totalPage = res.data.total;
  50. this.noticeList=res.data.items
  51. if(this.noticeList.length>0){
  52. var data=this.noticeList.filter((item)=>{return item.newsFlag==0})
  53. this.unreadList=data
  54. if(this.unreadList.length>0){
  55. for(var i=0;i<this.unreadList.length;i++){
  56. this.unreadList[i].newsFlag=1
  57. this.$request.baseRequest('admin.unimall.cardNewsInfo', 'update',{
  58. cardNewsInfo:JSON.stringify(this.unreadList[i]),
  59. }, failres => {
  60. console.log('res+++++', failres.errmsg)
  61. this.$refs.uToast.show({
  62. type: 'error',
  63. message: failres.errmsg,
  64. })
  65. uni.hideLoading()
  66. }).then(res => {})
  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>