index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view class="content">
  3. <loadSke :loading='loading'>
  4. <view class='list-item' v-for="(item, index) in applist" :key="index" @click="goMiniApp(item.appletAddress)">
  5. <image class="avatar" mode="aspectFill" :src="item.appletLogoFileUrl">
  6. <view class="item-right">
  7. <view class="top">
  8. <van-icon class="icon" name="/static/imgs/转发.png" size='14' />
  9. <van-icon class="icon" name="/static/imgs/不喜欢.png" @tap.stop='delSc(index)' size='12' />
  10. </view>
  11. <view class="center">
  12. <text class="details">{{item.appletIntroduce}}</text>
  13. </view>
  14. <view class="bottom">
  15. <text class="title">{{item.corporateName}}</text>
  16. <view class="right" v-if="false">
  17. <view class="flex">
  18. <van-icon class="icon" name="/static/imgs/评论.png" size='15' />
  19. <text>54</text>
  20. </view>
  21. <view class="flex">
  22. <van-icon class="icon" name="/static/imgs/好评率.png" size='15' />
  23. <text>99%</text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </loadSke>
  30. </view>
  31. </template>
  32. <script>
  33. import loadSke from '@/components/skeleton/index/index.vue'
  34. import {
  35. collectionList,
  36. delFavorites
  37. } from '@/api/applist.js'
  38. export default {
  39. components: {
  40. loadSke
  41. },
  42. data() {
  43. return {
  44. active: 0,
  45. current: 0,
  46. mode: 'round',
  47. applist: {},
  48. loading: true
  49. }
  50. },
  51. mounted() {
  52. this.initAppList()
  53. },
  54. methods: {
  55. initAppList() {
  56. collectionList({
  57. pageNum: 1,
  58. pageSize: 10
  59. }).then(res => {
  60. console.log(res)
  61. this.applist = res.rows
  62. this.$nextTick(() => {
  63. this.loading = false
  64. })
  65. })
  66. },
  67. delSc(index) {
  68. delFavorites(this.applist[index].customerId).then(res => {
  69. if (res.code == 200) {
  70. this.$set(this.applist[index], 'collectionStatus', '0')
  71. this.Toast('取消收藏成功!');
  72. delete this.applist.splice(index, 1)
  73. }
  74. })
  75. },
  76. goMiniApp(appId) {
  77. wx.navigateToMiniProgram({
  78. appId,
  79. success(res) {
  80. // 打开成功
  81. }
  82. })
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .content {
  89. padding-bottom: 1rpx;
  90. }
  91. .swiper-box {
  92. position: sticky;
  93. top: 0px;
  94. left: 0;
  95. height: 422rpx;
  96. z-index: 9;
  97. }
  98. .sticky-top {
  99. position: sticky;
  100. top: 192rpx;
  101. left: 0;
  102. margin: 30rpx 30rpx;
  103. border-radius: 20rpx;
  104. overflow: hidden;
  105. background-color: #4fc08d;
  106. z-index: 10;
  107. display: flex;
  108. justify-content: center;
  109. align-items: center;
  110. // border-top-left-radius: 14px;
  111. // border-top-right-radius: 14px;
  112. padding-right: 3%;
  113. .top-search {
  114. flex: 1;
  115. }
  116. }
  117. .sticky {
  118. position: sticky;
  119. top: 295rpx;
  120. left: 0;
  121. background-color: #fff;
  122. z-index: 9;
  123. margin: 30rpx 30rpx;
  124. border-radius: 20rpx;
  125. .grid {
  126. display: flex;
  127. justify-content: space-between;
  128. padding: 1% 2%;
  129. margin-bottom: 2%;
  130. border-bottom-left-radius: 10px;
  131. border-bottom-right-radius: 10px;
  132. .grid-item {
  133. width: 50px;
  134. height: 60px;
  135. display: flex;
  136. justify-content: center;
  137. flex-direction: column;
  138. align-items: center;
  139. font-size: 12px;
  140. }
  141. }
  142. }
  143. .list-item {
  144. display: flex;
  145. align-items: center;
  146. justify-content: space-between;
  147. background-color: #FFFFFF;
  148. height: 170rpx;
  149. padding: 34rpx 20rpx;
  150. margin: 24rpx 30rpx;
  151. border-radius: 20rpx;
  152. .avatar {
  153. flex-shrink: 0;
  154. width: 161rpx;
  155. height: 161rpx;
  156. margin-right: 16rpx;
  157. }
  158. .item-right {
  159. flex: 1;
  160. display: flex;
  161. flex-direction: column;
  162. justify-content: space-between;
  163. height: 200rpx;
  164. .top {
  165. .icon {
  166. margin-top: -20rpx;
  167. padding: 20rpx;
  168. }
  169. display: flex;
  170. justify-content: flex-end;
  171. }
  172. .center {
  173. align-self: flex-start;
  174. .details {
  175. width: 436rpx;
  176. height: 70rpx;
  177. font-size: 26rpx;
  178. font-family: PingFang SC;
  179. font-weight: 400;
  180. color: #0F0404;
  181. display: -webkit-box;
  182. margin-bottom: 20rpx;
  183. overflow: hidden;
  184. text-overflow: ellipsis;
  185. word-wrap: break-word;
  186. white-space: normal !important;
  187. -webkit-line-clamp: 2;
  188. -webkit-box-orient: vertical;
  189. }
  190. }
  191. .bottom {
  192. display: flex;
  193. justify-content: space-between;
  194. align-items: center;
  195. .title {
  196. padding: 3rpx 12rpx;
  197. height: 30rpx;
  198. background: #FFE6E6;
  199. border: 1rpx solid #E31818;
  200. border-radius: 2rpx;
  201. font-size: 20rpx;
  202. font-family: PingFang SC;
  203. font-weight: 400;
  204. color: #E31818;
  205. line-height: 20rpx;
  206. display: flex;
  207. justify-content: center;
  208. align-items: center;
  209. }
  210. .right {
  211. width: 170rpx;
  212. display: flex;
  213. justify-content: space-between;
  214. align-items: center;
  215. font-size: 22rpx;
  216. font-family: PingFang SC;
  217. font-weight: 400;
  218. color: #999999;
  219. line-height: 35rpx;
  220. .flex {
  221. display: flex;
  222. justify-content: center;
  223. .icon {
  224. margin-right: 5rpx;
  225. }
  226. }
  227. }
  228. }
  229. }
  230. }
  231. </style>