微信小程序信息展示列表

逃离我推掉我的手 2021-09-17 11:08 627阅读 0赞

标题图

微信小程序信息展示列表

效果展示:

效果展示

代码展示:

wxml

  1. <view class="head">
  2. <view class="head_item">分类</view>
  3. <view class="ring"></view>
  4. <view class="head_item">价格</view>
  5. </view>
  6. <block wx:for="{
  7. {ets}}">
  8. <view class="item" bindtap="seePerson" id="{
  9. {item.id}}">
  10. <view class='img'>
  11. <!-- img -->
  12. <image src="{
  13. {baseUrl}}{
  14. {item.avatar}}" style="width:100px;height:100px;"></image>
  15. </view>
  16. <view class="intro">
  17. <!-- 广东礼仪带队宵夜 -->
  18. <view class="position">
  19. {
  20. {item.name}}
  21. </view>
  22. <view class="jiaqian">
  23. ¥--/人
  24. </view>
  25. <view class="address">
  26. 原价:¥--
  27. </view>
  28. <!-- 广州市 | 共有49个案例,0个视频 -->
  29. <view class="dizhi">
  30. {
  31. {item.city}} {
  32. {item.gender}} {
  33. {item.age}} {
  34. {item.label}}
  35. </view>
  36. </view>
  37. <button class='but'>火爆</button>
  38. <view class='rendu'>
  39. 热度:190
  40. </view>
  41. </view>
  42. <view class="hr"></view>
  43. </block>
  44. <!--
  45. <view class="item">
  46. <view class='img'>
  47. <image src="{
  48. {img}}" style="width:100px;height:100px;"></image>
  49. </view>
  50. <view class="intro">
  51. <view class="position">
  52. 广东礼仪带队宵夜
  53. </view>
  54. <view class="jiaqian">
  55. ¥300/人
  56. </view>
  57. <view class="address">
  58. 原价:¥500
  59. </view>
  60. <view class="dizhi">
  61. 广州市 | 共有49个案例,0个视频
  62. </view>
  63. </view>
  64. <button class='but'>6.0折</button>
  65. <view class='rendu'>
  66. 热度:190
  67. </view>
  68. </view>
  69. <view class="hr"></view>
  70. <view class="item">
  71. <view class='img'>
  72. <image src="{
  73. {img}}" style="width:100px;height:100px;"></image>
  74. </view>
  75. <view class="intro">
  76. <view class="position">
  77. 广东礼仪带队宵夜
  78. </view>
  79. <view class="jiaqian">
  80. ¥300/人
  81. </view>
  82. <view class="address">
  83. 原价:¥500
  84. </view>
  85. <view class="dizhi">
  86. 广州市 | 共有49个案例,0个视频
  87. </view>
  88. </view>
  89. <button class='but'>6.0折</button>
  90. <view class='rendu'>
  91. 热度:190
  92. </view>
  93. </view>
  94. <view class="hr"></view>
  95. <view class="item">
  96. <view class='img'>
  97. <image src="{
  98. {img}}" style="width:100px;height:100px;"></image>
  99. </view>
  100. <view class="intro">
  101. <view class="position">
  102. 广东礼仪带队宵夜
  103. </view>
  104. <view class="jiaqian">
  105. ¥300/人
  106. </view>
  107. <view class="address">
  108. 原价:¥500
  109. </view>
  110. <view class="dizhi">
  111. 广州市 | 共有49个案例,0个视频
  112. </view>
  113. </view>
  114. <button class='but'>6.0折</button>
  115. <view class='rendu'>
  116. 热度:190
  117. </view>
  118. </view>
  119. <view class="hr"></view>
  120. <view class="item">
  121. <view class='img'>
  122. <image src="{
  123. {img}}" style="width:100px;height:100px;"></image>
  124. </view>
  125. <view class="intro">
  126. <view class="position">
  127. 广东礼仪带队宵夜
  128. </view>
  129. <view class="jiaqian">
  130. ¥300/人
  131. </view>
  132. <view class="address">
  133. 原价:¥500
  134. </view>
  135. <view class="dizhi">
  136. 广州市 | 共有49个案例,0个视频
  137. </view>
  138. </view>
  139. <button class='but'>6.0折</button>
  140. <view class='rendu'>
  141. 热度:190
  142. </view>
  143. </view>
  144. <view class="hr"></view> -->

wxss

  1. .item {
  2. display: flex;
  3. flex-direction: row;
  4. }
  5. .head_item {
  6. width: 374rpx;
  7. text-align: center;
  8. font-size: 30rpx;
  9. color: #fff;
  10. }
  11. .head {
  12. height:80rpx;
  13. background-color: #D53E37;
  14. border-top: 1rpx solid #fff;
  15. border-bottom: 1rpx solid rgba(204, 204, 204, 1);
  16. display: flex;
  17. align-items: center;
  18. top: 0;
  19. }
  20. .ring {
  21. width: 2rpx;
  22. height: 100%;
  23. background-color: rgba(204, 204, 204, 1);
  24. }
  25. .img {
  26. margin: 10rpx 0 10rpx 10rpx;
  27. }
  28. .intro {
  29. display: flex;
  30. flex-direction: column;
  31. margin-left: 10px;
  32. width: 100%;
  33. }
  34. .introing {
  35. display: flex;
  36. flex-direction: column;
  37. flex: right;
  38. margin-right: 30rpx;
  39. }
  40. .position {
  41. margin-top: 20rpx;
  42. width: 60%;
  43. font-size: 28rpx;
  44. font-weight: bold;
  45. }
  46. .jiaqian {
  47. font-size: 28rpx;
  48. color: red;
  49. margin-top: 20rpx;
  50. }
  51. .address {
  52. font-size: 25rpx;
  53. color: #999;
  54. margin-top: 20rpx;
  55. }
  56. .dizhi {
  57. font-size: 25rpx;
  58. margin-top: 20rpx;
  59. }
  60. .but {
  61. position: absolute;
  62. font-size: 25rpx;
  63. margin-left: 620rpx;
  64. margin-top: 55rpx;
  65. border: red;
  66. color: red;
  67. }
  68. .rendu {
  69. position: absolute;
  70. font-size: 25rpx;
  71. margin-left: 620rpx;
  72. margin-top: 120rpx;
  73. }
  74. .line {
  75. align-content: center;
  76. border: 1px solid #ccc;
  77. opacity: 0.2;
  78. }
  79. .hr {
  80. height: 10px;
  81. background-color: #eee;
  82. }

json

  1. {
  2. "navigationBarTitleText": "达叔小生",
  3. "enablePullDownRefresh": true
  4. }

js

  1. // 获取应用实例
  2. var app = getApp()
  3. Page({
  4. data: {
  5. ets: [],
  6. baseUrl: app.globalData.baseUrl
  7. },
  8. onLoad: function() {
  9. // this.loading();
  10. var that = this;
  11. that.loadPer();
  12. },
  13. // 加载艺人列表
  14. loadPer: function() {
  15. var that = this;
  16. wx.request({
  17. url: app.globalData.baseUrl + '/list/', // 接口地址
  18. method: 'GET',
  19. header: {
  20. 'content-type': 'application/json' //默认值
  21. },
  22. // 成功
  23. success: function(res) {
  24. console.log("加载艺人列表 成功", res.data.data);
  25. that.setData({
  26. ets: res.data.data
  27. });
  28. },
  29. // 失败
  30. fail: function(err) {
  31. console.log("加载艺人列表 失败", err);
  32. }
  33. })
  34. },
  35. // 下拉刷新
  36. onPullDownRefresh: function() {
  37. console.log("下拉刷新")
  38. var that = this;
  39. wx.showNavigationBarLoading()
  40. setTimeout(() => {
  41. that.loadPer();
  42. wx.hideNavigationBarLoading()
  43. wx.stopPullDownRefresh()
  44. }, 2000)
  45. },
  46. seePerson: function(e) {
  47. // if (!e.currentTarget.id == "") {
  48. // wx.navigateTo({
  49. // url: "../person/person?id=" + e.currentTarget.id
  50. // })
  51. // console.log(e)
  52. // } else {
  53. // console.log("无内容")
  54. // }
  55. if (!e.currentTarget.id == "") {
  56. wx.navigateTo({
  57. url: "../detailjiemu/detailjiemu?id=" + e.currentTarget.id
  58. })
  59. console.log(e)
  60. } else {
  61. console.log("无内容")
  62. }
  63. }
  64. })

达叔小生:往后余生,唯独有你
You and me, we are family !
90后帅气小伙,良好的开发习惯;独立思考的能力;主动并且善于沟通
简书博客: 达叔小生
https://www.jianshu.com/u/c785ece603d1

结语

  • 下面我将继续对 其他知识 深入讲解 ,有兴趣可以继续关注
  • 小礼物走一走 or 点赞

发表评论

表情:
评论列表 (有 0 条评论,627人围观)

还没有评论,来说两句吧...

相关阅读

    相关 程序播放音频列表

    微信小程序的音频播放    链接:[单曲播放][Link 1]   对于音频的播放,肯定会有多首音频的情况,这个时候播放下一曲的功能就需要做出来: 我这边做了一个粗糙的版