耀实惠小程序
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.

167 lines
3.4 KiB

  1. <template>
  2. <view class="pages">
  3. <!-- <view class="sort-search">
  4. <u-search
  5. v-model="keyword"
  6. bg-color="#fff"
  7. height="80"
  8. placeholder="日照香炉生紫烟"
  9. :action-style="{color: '#fff'}"
  10. />
  11. </view> -->
  12. <view class="top_bg_text" :style="'background-image: url('+pageImage+')'">
  13. </view>
  14. <view class="item" v-for="(items,index) in list" :key="index" @click="toDetale(items.id)">
  15. <view class="left_box">
  16. <text class="title m-t-20">{{items.title}}</text>
  17. <text>{{items.subTitle}}</text>
  18. <!-- <rich-text :nodes='items.article'></rich-text> -->
  19. <!-- <u-parse :html="items.article" ></u-parse> -->
  20. </view>
  21. <image class="img_" :src="items.cover" mode=""></image>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import config from "./config.js"
  27. export default {
  28. data() {
  29. return {
  30. htmls: '<text>adada</text>',
  31. pageImage: '', //背景图
  32. list: [],
  33. pageNo: 1,
  34. pageSize:10,
  35. title: '',
  36. total: null,
  37. islock: false, // 加载更多的锁
  38. }
  39. },
  40. onReachBottom() {
  41. if(!this.isLock) {
  42. if(this.pageNo * this.pageSize > this.total && this.total!== null) {
  43. // 没有更多加载了
  44. this.isLock = true;
  45. this.$Toast('没有更多数据了呢!');
  46. setTimeout(()=> {
  47. // 3秒后解锁
  48. this.isLock = false;
  49. },3000)
  50. return
  51. }
  52. this.isLock = true;
  53. this.pageNo+=1;
  54. this.getanswerList();
  55. }
  56. },
  57. onUnload() {
  58. var that = this;
  59. let page_url = getCurrentPages()
  60. console.log("=========" + getCurrentPages());
  61. if (page_url.length > 1) {
  62. var url = page_url[1].route;
  63. console.log(url);
  64. if (url == "pagesB/homeGridList/answerQuestionsPrize/index") {
  65. // 回首页
  66. uni.switchTab({
  67. url: "/pages/home/home",
  68. })
  69. }
  70. }
  71. },
  72. onLoad(options) {
  73. this.pageImage = options.pageImage
  74. this.getanswerList();
  75. },
  76. methods: {
  77. getanswerList() {
  78. uni.showLoading();
  79. const params = {
  80. pageNo: this.pageNo,
  81. pageSize: this.pageSize
  82. }
  83. this.$api('answerList',params).then( res => {
  84. let { code, result, message} = res
  85. if(code == 200) {
  86. uni.hideLoading();
  87. this.isLock = false;
  88. this.list = this.list.concat(result.records);
  89. }else {
  90. this.$Toast(message)
  91. }
  92. }).catch(err => {
  93. this.isLock = false;
  94. uni.hideLoading()
  95. this.$Toast(err.message)
  96. })
  97. },
  98. toDetale(id) {
  99. uni.navigateTo({
  100. url: "./detale/detale?id="+id
  101. })
  102. },
  103. }
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .sort-search {
  108. padding: 0 20rpx 20rpx;
  109. background: $u-type-primary;
  110. }
  111. .pages{
  112. background-color: #F5F5F5;
  113. height: 100%;
  114. .item{
  115. width: 100%;
  116. display: flex;
  117. margin-top: 21rpx;
  118. background-color: #fff;
  119. font-size: 27rpx;
  120. box-sizing: border-box;
  121. padding-left: 26rpx;
  122. padding-right: 20rpx;
  123. .left_box{
  124. flex: 1;
  125. display: flex;
  126. flex-direction: column;
  127. .title{
  128. font-weight: bold;
  129. margin-top: 16prx;
  130. margin-bottom: 7rpx;
  131. color: #000;
  132. }
  133. .alt{
  134. color: #707070;
  135. }
  136. }
  137. .img_{
  138. width: 188rpx;
  139. height: 212rpx;
  140. margin: 20rpx;
  141. }
  142. }
  143. }
  144. .top_bg_text{
  145. width: 100%;
  146. height: 184rpx;
  147. margin-top: 30rpx;
  148. background-size: 100% 184rpx;
  149. display: flex;
  150. flex-direction: column;
  151. align-items: center;
  152. .title_max{
  153. margin-top: 20rpx;
  154. font-size: 54rpx;
  155. font-weight: bold;
  156. color: #73B8DE;
  157. }
  158. .title_min{
  159. margin-top: 10rpx;
  160. font-size: 28rpx;
  161. color: #73B8DE;
  162. }
  163. }
  164. </style>