message.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class="center">
  3. <view class="massage flex" v-for="(item, index) in list" :key="index"
  4. @click="nav('/pages/index/messageInfo?id=' + item.id)">
  5. <view class="imagebox" v-if="type == 7">
  6. <image class="image" :src="item.image_input[0]" mode="scaleToFill"></image>
  7. </view>
  8. <view class="right flex">
  9. <view class="title">{{ item.title }}</view>
  10. <view class="time">{{ item.add_time }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import {
  17. article
  18. } from '@/api/user.js';
  19. export default {
  20. data() {
  21. return {
  22. list: [],
  23. type: ''
  24. };
  25. },
  26. onLoad(opt) {
  27. if (opt.type) {
  28. this.type = opt.type;
  29. let title = '';
  30. if (opt.type == 1) {
  31. title = '官方公告';
  32. } else if (opt.type == 2) {
  33. title = '拍品介绍';
  34. } else if (opt.type == 6) {
  35. title = '首页新闻';
  36. } else if (opt.type == 7) {
  37. title = '最新资讯';
  38. }
  39. uni.setNavigationBarTitle({
  40. title
  41. });
  42. }
  43. let obj = this;
  44. article({
  45. page: 1,
  46. limit: 1000
  47. }, this.type).then(({
  48. data
  49. }) => {
  50. this.list = data;
  51. });
  52. },
  53. methods: {
  54. nav(url) {
  55. uni.navigateTo({
  56. url
  57. });
  58. }
  59. }
  60. };
  61. </script>
  62. <style lang="less">
  63. .center {
  64. background: #f3f3f3;
  65. font-family: PingFang SC;
  66. .right {
  67. align-self: stretch;
  68. flex-grow: 1;
  69. flex-direction: column;
  70. align-items: flex-start;
  71. }
  72. .imagebox{
  73. flex-shrink: 0;
  74. padding-right: 20rpx;
  75. .image{
  76. width: 200rpx;
  77. height: 160rpx;
  78. }
  79. }
  80. }
  81. .massage {
  82. background: #ffffff;
  83. padding: 30rpx;
  84. border-bottom: 1px solid #e9e9e9;
  85. font-weight: 500;
  86. .title {
  87. font-size: 28rpx;
  88. color: #333333;
  89. }
  90. .time {
  91. margin-top: 18rpx;
  92. font-size: 20rpx;
  93. color: #999999;
  94. }
  95. }
  96. </style>