messageList.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="content">
  3. <view class="iconmessage-box" v-for="(item,index) in messageDate" @click="navTo(item.id)">
  4. <view class="box-left">
  5. <!-- <view class="img">
  6. <image :src="item.img" mode=""></image>
  7. </view> -->
  8. <view class="box-title">
  9. <view class="title">
  10. {{item.title}}
  11. </view>
  12. <view class="detail">
  13. {{item.content}}
  14. </view>
  15. </view>
  16. </view>
  17. <view class="box-right">
  18. <view class="time">
  19. {{item.add_time}}
  20. </view>
  21. <view class="tishi" v-if="item.status!=1">
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. getMessage
  30. } from '@/api/index.js'
  31. export default {
  32. data() {
  33. return {
  34. id:0,
  35. page:1,
  36. limit:10,
  37. messageDate: []
  38. };
  39. },
  40. onLoad(options) {
  41. this.id = options.id
  42. console.log(this.id, '打印');
  43. this.getMessage()
  44. },
  45. onShow() {
  46. this.getMessage()
  47. },
  48. computed: {
  49. },
  50. methods: {
  51. navTo(id) {
  52. uni.navigateTo({
  53. url: '/pages/user/messageDetail?id=' + id
  54. })
  55. },
  56. getMessage() {
  57. console.log(this.id);
  58. getMessage({
  59. type:this.id,
  60. page:this.page,
  61. limit:this.limit
  62. }).then(res => {
  63. this.messageDate = res.data
  64. // this.messageDetail =res.data
  65. // this.messageDate[0].messageDetail = res.data.xt
  66. // this.messageDate[1].messageDetail = res.data.xx
  67. // this.messageDate[2].messageDetail = res.data.yj
  68. // this.messageDate[3].messageDetail = res.data.fh
  69. // this.messageDate[4].messageDetail = res.data.dg
  70. console.log(res, 'res');
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. page,
  78. .content {
  79. padding: 0;
  80. margin: 0;
  81. width: 100%;
  82. height: 100%;
  83. background: #f3f3f3;
  84. }
  85. .iconmessage-box {
  86. width: 750rpx;
  87. display: flex;
  88. justify-content: space-between;
  89. padding: 20rpx 30rpx;
  90. .box-left {
  91. display: flex;
  92. .img {
  93. margin: 10rpx 25rpx 10rpx 0;
  94. width: 70rpx;
  95. height: 70rpx;
  96. border-radius: 50%;
  97. overflow: hidden;
  98. image {
  99. width: 100%;
  100. height: 100%;
  101. }
  102. }
  103. .box-title {
  104. display: flex;
  105. width: 350rpx;
  106. flex-direction: column;
  107. .title {
  108. font-size: 34rpx;
  109. font-weight: 500;
  110. }
  111. .detail {
  112. font-size: 24rpx;
  113. color: #909090;
  114. }
  115. }
  116. }
  117. .box-right {
  118. display: flex;
  119. flex-direction: column;
  120. // justify-content: flex-end;
  121. .time {
  122. margin: 10rpx 0;
  123. font-size: 24rpx;
  124. color: #909090;
  125. }
  126. .tishi {
  127. margin-left: auto;
  128. width: 15rpx;
  129. height: 15rpx;
  130. border-radius: 50%;
  131. background-color: red;
  132. margin-right: 30rpx;
  133. }
  134. }
  135. }
  136. </style>