knowledgeList.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view>
  3. <u-navbar title="用电知识" title-color="#101010" ></u-navbar>
  4. <view class="main" >
  5. <view class="item" v-for="(item,i) in list"
  6. @click="gotoUrlBtn(item)"
  7. :key="i">
  8. <view class="item-message">
  9. <view>{{item.title}}</view>
  10. </view>
  11. <view class="item-time" style="display: flex;">
  12. <!-- {{item.tenantName}} -->
  13. <view>{{item.createTime}}</view>
  14. <view style="margin-left: 40rpx;">阅读量:{{item.readNum}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <u-divider :isnone="list.length==0" nonetext="没有找到相关内容"
  19. border-color="#CFD2D5">已经到底了</u-divider>
  20. </view>
  21. </template>
  22. <script>
  23. import * as API from '@/apis/pagejs/message.js'
  24. export default {
  25. data() {
  26. return {
  27. type:10,
  28. formData:{
  29. type:10,
  30. pageIndex:1,
  31. pageSize:20,
  32. },
  33. typeName:"",
  34. list:[],
  35. recordsTotal:0
  36. }
  37. },
  38. computed:{
  39. },
  40. onLoad(op) {
  41. this.getList()
  42. },
  43. onReachBottom() {
  44. if (this.list.length < this.recordsTotal) {
  45. this.myLoadmore();
  46. }
  47. },
  48. methods: {
  49. gotoUrlBtn(item){
  50. uni.navigateTo({
  51. url:"/pages/message/knowledge?id="+item.id
  52. })
  53. },
  54. getList(){
  55. this.getMessageList()
  56. },
  57. myLoadmore() {
  58. this.formData.pageIndex += 1;
  59. this.getList()
  60. },
  61. getMessageList(){
  62. uni.showLoading({
  63. mask:true,title:'加载中...'
  64. })
  65. API.newsList(this.formData).then((res) => {
  66. uni.hideLoading();
  67. if(this.formData.pageIndex==1){
  68. this.list = [
  69. ...res.data.data
  70. ];
  71. }else{
  72. this.list = [
  73. ...this.list,
  74. ...res.data.data
  75. ];
  76. }
  77. this.recordsTotal = res.data.recordsTotal;
  78. //this.list=response.data.data;
  79. }).catch(error => {
  80. uni.hideLoading();
  81. uni.showToast({
  82. icon: "none",
  83. title: error
  84. })
  85. })
  86. },
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .main{
  92. margin-top: 24rpx;
  93. .item-main{
  94. display: flex;
  95. align-items: center;
  96. justify-content: space-between;
  97. }
  98. .item{
  99. background-color: #fff;
  100. margin: 32rpx;
  101. padding: 32rpx;
  102. border-bottom: 1px solid rgba(244,244,244,1);
  103. border-radius: 8px;
  104. box-shadow: 0px 2px 6px 0px rgba(0,61,146,0.05);
  105. .item-message{
  106. line-height: 44rpx;
  107. font-weight: bold;
  108. display: flex;
  109. font-size: 28rpx;
  110. justify-content: space-between;
  111. color: rgba(51,51,51,1);
  112. .billAmount{
  113. color: #F44336;
  114. }
  115. .gotoBtn{
  116. color:#1677FF
  117. }
  118. }
  119. .item-time2{
  120. color: rgb(153,153,153);
  121. font-size: 28rpx;
  122. margin-top: 16rpx;
  123. }
  124. .item-time{
  125. color: rgb(153,153,153);
  126. font-size: 24rpx;
  127. margin-top: 16rpx;
  128. }
  129. }
  130. }
  131. </style>