studyList.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="studyList">
  3. <!-- 列表 -->
  4. <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
  5. <view class="left">
  6. <view class="store-item" v-for="(item,index) in list" :key="index" @click="goGoodsDetail(item.goodsId)">
  7. <zs-img :src="item.logoPath" width="344rpx" height="344rpx" mode=""></zs-img>
  8. <view class="info">
  9. <view class="title">
  10. {{item.goodsName}}
  11. </view>
  12. <view class="user-info">
  13. <image class="head" :src="item.logoPath" mode=""></image>
  14. <view class="user-name">
  15. {{item.shopName}}
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="right">
  22. <view class="store-item" v-for="(item,index) in list1" :key="index" @click="goGoodsDetail(item.goodsId)">
  23. <zs-img :src="item.logoPath" width="344rpx" height="344rpx" mode=""></zs-img>
  24. <view class="info">
  25. <view class="title">
  26. {{item.goodsName}}
  27. </view>
  28. <view class="user-info">
  29. <image class="head" :src="item.logoPath" mode=""></image>
  30. <view class="user-name">
  31. {{item.shopName}}
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </zs-list>
  38. </view>
  39. </template>
  40. <script>
  41. import {studyGoods} from '@/api/study.js';
  42. export default {
  43. data() {
  44. return {
  45. status: 'more',
  46. list: [],
  47. list1: [],
  48. query:{
  49. columnId:'',
  50. currentPage:1,
  51. pageSize:10,
  52. }
  53. }
  54. },
  55. methods: {
  56. // 去商品详情
  57. goGoodsDetail(id){
  58. uni.navigateTo({
  59. url:'/study/studyGoodsDetail?id='+id
  60. })
  61. },
  62. loadMore() {
  63. this.studyGoodsList()
  64. },
  65. studyGoodsList(){
  66. this.status = 'loading'
  67. studyGoods(this.query).then(res=>{
  68. if(res.state == 'Success'){
  69. let list = []
  70. let list1 = []
  71. res.content.records.map((item,index)=>{
  72. if(index%2){
  73. list1.push(item)
  74. }else{
  75. list.push(item)
  76. }
  77. })
  78. this.list = this.list.concat(list)
  79. this.list1 = this.list1.concat(list1)
  80. let total = this.list.length+this.list1.length
  81. if(total>=res.content.total){
  82. this.status = 'noMore'
  83. }else{
  84. this.status = 'more'
  85. this.query.currentPage++
  86. }
  87. }
  88. })
  89. },
  90. },
  91. created() {
  92. },
  93. onLoad(option) {
  94. this.query.columnId = option.id
  95. uni.setNavigationBarTitle({
  96. title: option.title
  97. });
  98. }
  99. }
  100. </script>
  101. <style lang="scss" >
  102. .studyList{
  103. background: #FFFFFF;
  104. padding: 20rpx;
  105. .zs-list {
  106. display: flex;
  107. flex-wrap: wrap;
  108. justify-content: space-between;
  109. .left {
  110. }
  111. .right {
  112. }
  113. .store-item{
  114. box-shadow: 0rpx 0rpx 24rpx 2rpx rgba(0,0,0,0.08);
  115. border-radius: 16rpx;
  116. width: 344rpx;
  117. margin-top: 20rpx;
  118. .info{
  119. padding: 20rpx;
  120. .title{
  121. color: #222222;
  122. font-size: 24rpx;
  123. width: 100%;
  124. display: -webkit-box;
  125. -webkit-box-orient: vertical;
  126. -webkit-line-clamp: 2; /* 显示的最大行数 */
  127. overflow: hidden;
  128. }
  129. .user-info{
  130. display: flex;
  131. align-items: center;
  132. margin-top: 20rpx;
  133. .head{
  134. width: 40rpx;
  135. height: 40rpx;
  136. border-radius: 50%;
  137. }
  138. .user-name{
  139. color: #AAAAAA;
  140. font-size: 20rpx;
  141. margin-left: 12rpx;
  142. }
  143. }
  144. }
  145. }
  146. }
  147. }
  148. </style>