help.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="main">
  3. <view class="articles">
  4. <view class="list-box" v-if="dataList.length<=0">
  5. <view class="no-data">
  6. <image class="icon" src="/static/icons/no-data.png" mode=""></image>
  7. <view class="text">
  8. -- {{lang.no_data}} --
  9. </view>
  10. </view>
  11. </view>
  12. <view class="list-box" v-else>
  13. <view class="lists" v-for="(v,k) in dataList" :key="k">
  14. <view class="list-item" @click="gotoPage('/pages/article/info?id='+v.id)">
  15. <view class="name">
  16. <text class="text">{{k+1}}.{{v.title}}</text>
  17. <image class="icon right" src="/static/icons/right.png" mode=""></image>
  18. </view>
  19. <view class="info">
  20. <view class="text">{{v.message}}
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <u-loadmore :status="loadStatus"></u-loadmore>
  26. </view>
  27. </view>
  28. <!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
  29. <tabbars :currentIndex="1"></tabbars>
  30. </view>
  31. </template>
  32. <script>
  33. import tabbars from "@/components/tabbar.vue"
  34. export default {
  35. components: {
  36. tabbars
  37. },
  38. data() {
  39. return {
  40. loadMore: false,
  41. loadStatus: 'loadmore',
  42. loaded: false,
  43. params: {
  44. page: 1,
  45. pageSize: 15,
  46. },
  47. dataList: [],
  48. }
  49. },
  50. onLoad() {
  51. this.getData()
  52. uni.setNavigationBarTitle({
  53. title: this.lang.help_title
  54. })
  55. },
  56. onReachBottom() {
  57. if (!this.loaded) {
  58. this.params.page++;
  59. this.loadMore = true
  60. this.getData();
  61. }
  62. },
  63. methods: {
  64. // 获取数据
  65. getData() {
  66. let _this = this;
  67. _this.loadStatus = 'loading'
  68. let params = JSON.parse(JSON.stringify(this.params));
  69. this.$request.sendToken('/api/article/help', params, 'POST').then(res => {
  70. _this.loadStatus = 'loadmore'
  71. if (res.success == true) {
  72. if (_this.loadMore == true && res.data.list.length > 0) {
  73. let len = res.data.list.length
  74. for (let i = 0; i <= len; i++) {
  75. if (typeof(res.data.list[i]) != 'undefined') {
  76. _this.dataList.push(res.data.list[i])
  77. }
  78. }
  79. _this.loadMore = false
  80. } else if (res.data.list.length > 0) {
  81. _this.dataList = res.data.list ? res.data.list : [];
  82. }
  83. if (this.params.page != 1 && res.data.list.length <= 0) {
  84. _this.loaded = true
  85. _this.loadStatus = 'nomore'
  86. }
  87. if (this.params.page == 1 && res.data.list.length <= 0) {
  88. _this.loaded = true
  89. _this.loadStatus = 'nodata'
  90. }
  91. } else {
  92. this.$u.toast(res.msg);
  93. }
  94. })
  95. },
  96. }
  97. }
  98. </script>
  99. <style lang="scss">
  100. .articles {
  101. padding-bottom: 198rpx;
  102. padding-top: 38rpx;
  103. }
  104. .lists {
  105. color: #999;
  106. margin: 20rpx 40rpx;
  107. padding: 20rpx;
  108. border-radius: 20rpx;
  109. // background-color: #36373F;
  110. background: linear-gradient(275deg, rgba(45, 45, 53, 0.1) 0%, #505058 100%);
  111. .u-row {
  112. overflow: hidden;
  113. }
  114. .list-item {
  115. .name {
  116. width: 100%;
  117. vertical-align: middle;
  118. display: block;
  119. .icon {
  120. vertical-align: middle;
  121. width: 46rpx;
  122. height: 46rpx;
  123. }
  124. .text {
  125. vertical-align: middle;
  126. margin-left: 10rpx;
  127. }
  128. .right {
  129. float: right;
  130. }
  131. }
  132. .info {
  133. .text {
  134. margin-left: 38rpx;
  135. max-width: 80%;
  136. }
  137. }
  138. }
  139. }
  140. .no-data {
  141. text-align: center;
  142. margin-top: 40%;
  143. color: #6e6c6b;
  144. .icon {
  145. width: 120rpx;
  146. height: 120rpx;
  147. margin: 0 auto;
  148. }
  149. }
  150. </style>