index.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="">
  3. <no-none v-if="list.length<=0"></no-none>
  4. <block v-else>
  5. <view class="itemContent" v-for="(item,index) of list" @click="onNavigateTo(item.id)" :key='index' >
  6. <view class="">
  7. {{item.title}}
  8. </view>
  9. <view class="box-pack-between">
  10. <view class="">
  11. </view>
  12. <view class="itemContentTime">
  13. {{item.create_time}}
  14. </view>
  15. </view>
  16. </view>
  17. <loading :is_load="is_load" :is_load_more='is_load_more'></loading>
  18. </block>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. list: [],
  26. page: 1,
  27. store_id: "",
  28. is_load: false,
  29. is_load_more: false,
  30. }
  31. },
  32. onLoad(e) {
  33. uni.setNavigationBarColor({
  34. frontColor: '#ffffff',
  35. backgroundColor: this.$store.state.color,
  36. })
  37. this.http();
  38. },
  39. onReachBottom() {
  40. if (!this.is_load) {
  41. this.page = this.page + 1;
  42. this.http();
  43. }
  44. },
  45. methods: {
  46. onNavigateTo(id){
  47. uni.navigateTo({
  48. url:`/shop/richText/index?id=${id}`
  49. })
  50. },
  51. http() {
  52. let store_id = uni.getStorageSync('store_id');
  53. this.$http.request('yy/article_list', {
  54. store_id,
  55. page:this.page,
  56. limit:30
  57. }).then(res => {
  58. if (res.code == "200") {
  59. if (res.data.length == 0) {
  60. this.is_load = true,
  61. this.is_load_more = true,
  62. setTimeout(() => {
  63. this.is_load_more = false
  64. }, 1e3);
  65. return
  66. }
  67. this.is_load = false;
  68. this.list = this.list.concat(res.data);
  69. }
  70. }).catch((res) => {
  71. uni.showToast({
  72. title: res.message,
  73. icon: 'none'
  74. })
  75. });
  76. }
  77. },
  78. }
  79. </script>
  80. <style>
  81. page{
  82. background: #FFFFFF;
  83. }
  84. .itemContent{
  85. padding: 20rpx;
  86. border-bottom: 1rpx solid #F1F1F1;
  87. }
  88. .itemContentTime{
  89. font-size: 26rpx;
  90. color: #999;
  91. padding-top: 20rpx;
  92. }
  93. </style>