瑶都万能墙
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
1.8 KiB

  1. <template>
  2. <view class="page">
  3. <navbar title="江华"/>
  4. <view class="content">
  5. <view class="article-list" v-if="!loading">
  6. <article-item
  7. v-for="(item, index) in List"
  8. :key="item.id || index"
  9. :item="item"
  10. @click="handleItemClick"
  11. />
  12. </view>
  13. <!-- 加载状态 -->
  14. <view class="loading-container" v-if="loading">
  15. <text class="loading-text">加载中...</text>
  16. </view>
  17. <!-- 空状态 -->
  18. <view class="empty-container" v-if="!loading && List.length === 0">
  19. <text class="empty-text">暂无文章</text>
  20. </view>
  21. </view>
  22. <tabber select="1" />
  23. </view>
  24. </template>
  25. <script>
  26. import tabber from '@/components/base/tabbar.vue'
  27. import articleItem from '@/components/list/articleItem.vue'
  28. import loadList from '@/mixins/loadList.js'
  29. export default {
  30. mixins: [loadList],
  31. components : {
  32. tabber,
  33. articleItem
  34. },
  35. data() {
  36. return {
  37. mixinsListApi: 'articleList'
  38. }
  39. },
  40. methods: {
  41. // 处理文章点击事件
  42. handleItemClick(item) {
  43. console.log('点击了文章:', item);
  44. // 跳转到文章详情页
  45. uni.navigateTo({
  46. url: `/pages_order/article/index?id=${item.id}`
  47. })
  48. }
  49. }
  50. }
  51. </script>
  52. <style scoped lang="scss">
  53. .page {
  54. background-color: #f5f5f5;
  55. min-height: 100vh;
  56. }
  57. .content {
  58. padding: 20rpx;
  59. padding-bottom: 120rpx; // 为底部tabbar留出空间
  60. }
  61. .article-list {
  62. display: flex;
  63. flex-direction: column;
  64. gap: 20rpx;
  65. }
  66. .loading-container {
  67. display: flex;
  68. justify-content: center;
  69. align-items: center;
  70. padding: 100rpx 0;
  71. .loading-text {
  72. font-size: 28rpx;
  73. color: #999;
  74. }
  75. }
  76. .empty-container {
  77. display: flex;
  78. justify-content: center;
  79. align-items: center;
  80. padding: 100rpx 0;
  81. .empty-text {
  82. font-size: 28rpx;
  83. color: #999;
  84. }
  85. }
  86. </style>