optionsList.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view>
  3. <u-navbar title="意见反馈">
  4. </u-navbar>
  5. <view class="main">
  6. <view class="item" v-for="(item, index) in optionsList" :key="index">
  7. <view class="item-content">
  8. {{item.content}}
  9. </view>
  10. <view class="item-picture" v-if="item.imageList != 0">
  11. <view class="picture-box" v-for="(a, i) in item.imageList" :key="i">
  12. <img :src="a.image" alt="">
  13. </view>
  14. </view>
  15. <view class="item-time">
  16. {{item.createTime}}
  17. </view>
  18. </view>
  19. </view>
  20. <u-divider v-if="optionsList.length == recordsTotal && recordsTotal != 0" style="margin-top: 10px">
  21. 没有更多了</u-divider>
  22. <!-- 按钮 -->
  23. <button class="btn" @click="toOption">意见反馈</button>
  24. </view>
  25. </template>
  26. <script>
  27. import * as mineApi from '@/apis/parents/mine.js'
  28. export default {
  29. data() {
  30. return {
  31. pageIndex: 1,
  32. pageSize: 5,
  33. recordsTotal: 0,
  34. optionsList: []
  35. }
  36. },
  37. onShow() {
  38. this.getOptionsList(true);
  39. },
  40. onReachBottom() {
  41. if (this.optionsList.length < this.recordsTotal) {
  42. this.myLoadmore();
  43. }
  44. },
  45. methods: {
  46. toOption() {
  47. uni.navigateTo({
  48. url: '/pages/parents/mine/opinion'
  49. })
  50. },
  51. myLoadmore() {
  52. this.pageIndex += 1;
  53. this.getOptionsList()
  54. },
  55. getOptionsList(bl) {
  56. uni.showLoading({
  57. title: "加载中",
  58. mask: true,
  59. })
  60. if (bl) {
  61. this.optionsList = [];
  62. this.pageIndex = 1;
  63. }
  64. mineApi.feedbackPageList({
  65. pageIndex: this.pageIndex,
  66. pageSize: this.pageSize
  67. }).then((res) => {
  68. uni.hideLoading();
  69. this.optionsList = [
  70. ...this.optionsList,
  71. ...res.data.data
  72. ];
  73. this.recordsTotal = res.data.recordsTotal;
  74. }).catch(error => {
  75. uni.showToast({
  76. title: error,
  77. icon: "none"
  78. })
  79. })
  80. },
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .main{
  86. background-color: #fff;
  87. .item{
  88. margin: 0 32rpx;
  89. padding: 24rpx 0;
  90. border-bottom: 1px solid #e8e8e8;
  91. .item-content{
  92. color: rgba(51, 51, 51, 1);
  93. font-size: 32rpx;
  94. }
  95. .item-picture{
  96. margin-top: 24rpx;
  97. display: flex;
  98. .picture-box{
  99. width: 160rpx;
  100. height: 160rpx;
  101. border-radius: 2px;
  102. margin-right: 16rpx;
  103. img{
  104. width: 100%;
  105. }
  106. }
  107. }
  108. .item-time{
  109. color: rgba(119, 119, 119, 1);
  110. font-size: 24rpx;
  111. margin-top:24rpx;
  112. }
  113. }
  114. }
  115. .btn{
  116. width: 686rpx;
  117. position: fixed;
  118. bottom:24rpx;
  119. left: 0;
  120. right: 0;
  121. border-radius: 50px;
  122. background-color: rgba(13, 186, 199, 1);
  123. color: rgba(255, 255, 255, 1);
  124. font-size: 32rpx;
  125. }
  126. </style>