information.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="container">
  3. <view v-if="list.length > 0" class="list-box flex_item" v-for="(ls,index) in list" :key='index' @click="nav(index)">
  4. <image :src="ls.image_input[0]"></image>
  5. <view class="list-item">
  6. <view class="title ellipsis">{{ls.title}}</view>
  7. <!-- <view class="time">{{ls.add_time}}</view> -->
  8. </view>
  9. </view>
  10. <view class="empty-box" v-show="list.length === 0"><empty></empty></view>
  11. </view>
  12. </template>
  13. <script>
  14. import { article } from '@/api/index.js';
  15. import empty from '@/components/empty';
  16. export default {
  17. components: {
  18. empty
  19. },
  20. data() {
  21. return {
  22. list:''
  23. };
  24. },
  25. onLoad(option){
  26. this.loadData();
  27. },
  28. onShow() {
  29. },
  30. methods: {
  31. // 请求载入数据
  32. async loadData() {
  33. let obj = this;
  34. article({
  35. page:1,
  36. limit:10000
  37. },1).then(({ data }) => {
  38. console.log(data)
  39. obj.list = data;
  40. });
  41. },
  42. nav(index){
  43. uni.navigateTo({
  44. url: '/pages/index/informationDetails?id=' + this.list[index].id
  45. })
  46. },
  47. }
  48. };
  49. </script>
  50. <style lang="scss">
  51. page {
  52. min-height: 100%;
  53. background-color: #ffffff;
  54. .container {
  55. width: 100%;
  56. padding: 25rpx 27rpx;
  57. }
  58. }
  59. .empty-box{
  60. margin-top: 100rpx;
  61. width: 100%;
  62. height: 500rpx;
  63. }
  64. .list-box{
  65. border-bottom: 1rpx solid #E3E3E3;
  66. margin-bottom: 25rpx;
  67. padding-bottom: 25rpx;
  68. image{
  69. width: 200rpx;
  70. height: 160rpx;
  71. border-radius: 15rpx;
  72. }
  73. .list-item{
  74. padding-left: 16rpx;
  75. width: 80%;
  76. .title{
  77. height: 80rpx;
  78. color: #333333;
  79. font-size: 30rpx;
  80. font-weight: 500;
  81. }
  82. .time{
  83. padding-top: 40rpx;
  84. color: #999999;
  85. font-size: 24rpx;
  86. }
  87. }
  88. }
  89. </style>