• 模仿快猫猫App实现的微信小程序,前端页面基本完成


    概述

    模仿快猫猫App实现的微信小程序,前端页面基本完成,通过微信开发这工具可以直接跑,代码没有问题,首页数据已经模拟,上拉加载等。

    详细

    通过小程序模拟快猫猫App的前端页面。代码简单易懂,没有什么高深的技术,js+css+xml都分离开了。适合初学者学习使用。

    一、项目目录

    WX20190309-203826@2x.png

    首页index.wxml

    1. <!--pages/home/home.wxml-->
    2. <view style='background:#EEE'>
    3. <swiper
    4. indicator-dots="{{indicatorDots}}"
    5. indicator-color="{{indicatorColor}}"
    6. indicator-active-color="{{indicatorActiveColor}}"
    7. autoplay="{{autoplay}}"
    8. interval="{{interval}}"
    9. duration="{{duration}}"
    10. circular="{{circular}}"
    11. >
    12. <block wx:for="{{swipers}}" >
    13. <swiper-item>
    14. <image src="{{item.imgUrl}}" class="slide-image" />
    15. </swiper-item>
    16. </block>
    17. </swiper>
    18. <view class='home-content'>
    19. <view class='home-title'>
    20. <text style='font-weight:bold;color:#000'>火爆特卖</text>
    21. <text>更多新品</text>
    22. </view>
    23. </view>
    24. <view class='lists'>
    25. <view class='list' bindtap='toDetail' wx:for="{{items}}" wx:for-index="index" wx:for-item="item" data-obj='{{item}}'>
    26. <image class='list-left' src='{{item.imgUrl}}'></image>
    27. <view class='list-right'>
    28. <view class='right-text'>{{item.title}}</view>
    29. <view>
    30. <view class='money'>¥ 199</view>
    31. <view class='currency'>赠送:179800猫币</view>
    32. <view class='sell'>已售:128900</view>
    33. </view>
    34. </view>
    35. </view>
    36. </view>
    37. </view>

    首页index.css

    1. /* pages/home/home.wxss */
    2. .slide-image{
    3. width: 100%;
    4. }
    5. .home-content{
    6. padding: 0 20rpx ;
    7. box-sizing: border-box;
    8. }
    9. .home-title{
    10. display: flex;
    11. justify-content: space-between;
    12. padding: 30rpx 10rpx;
    13. background: #FFF;
    14. box-sizing: border-box;
    15. }
    16. .home-title text{
    17. font-size: 16px;
    18. color: #808080;
    19. }
    20. .lists{
    21. padding: 0 20rpx ;
    22. box-sizing: border-box;
    23. }
    24. .list{
    25. padding: 30rpx 10rpx;
    26. background: #FFF;
    27. box-sizing: border-box;
    28. display: flex;
    29. flex-direction: row;
    30. margin-top: 20rpx;
    31. }
    32. .list-left{
    33. width:46%;
    34. height:160px
    35. }
    36. .list-right{
    37. width:50%;
    38. height:160px;
    39. padding-left:36rpx;
    40. display: flex;
    41. flex-direction: column;
    42. justify-content: space-between;
    43. }
    44. .right-text{
    45. display: -webkit-box;
    46. -webkit-box-orient: vertical;
    47. -webkit-line-clamp: 2;
    48. overflow: hidden;
    49. }
    50. .money{
    51. color:#e91e56;
    52. font-weight:bold;
    53. font-size:20px;
    54. }
    55. .currency{
    56. font-size: 16px;
    57. margin-top: 10rpx;
    58. }
    59. .sell{
    60. font-size: 14px;
    61. color:#808080;
    62. }

    首页index.js

    1. // pages/home/home.js
    2. Page({
    3. /**
    4. * 页面的初始数据
    5. */
    6. data: {
    7. swipers:[
    8. {
    9. id:0,
    10. imgUrl:'../img/swiper1.jpg'
    11. },
    12. {
    13. id: 1,
    14. imgUrl: '../img/swiper2.jpg'
    15. },
    16. {
    17. id: 2,
    18. imgUrl: '../img/swiper3.jpg'
    19. },
    20. ],
    21. indicatorDots:true,
    22. indicatorColor:"#000000",
    23. indicatorActiveColor:"#e91e56",
    24. autoplay:true,
    25. interval:3000,
    26. duration:500,
    27. circular:true,
    28. items:[
    29. {
    30. id:0,
    31. title:'灯,照明用品,泛指可以照亮的用具。人类远古时代用火把照明,后来有了蜡烛和油灯',
    32. money:'199',
    33. imgUrl:'../img/shop1.jpg',
    34. currency:'17890',
    35. sell:'12860'
    36. },
    37. {
    38. id: 1,
    39. title: '花,汉语常用字,读作huā,最早见于金文,其本义是花朵,后引申为像花的东西、错杂的颜色、虚伪的、模糊不清、用掉等义',
    40. money: '128',
    41. imgUrl: '../img/shop2.jpg',
    42. currency: '18908',
    43. sell: '12900'
    44. },
    45. {
    46. id: 2,
    47. title: '宝石(jewel)指那种经过琢磨和抛光后,可以达到珠宝要求的石料或矿物装嵌。',
    48. money: '3988',
    49. imgUrl: '../img/shop3.gif',
    50. currency: '550000',
    51. sell: '1289'
    52. },
    53. {
    54. id: 3,
    55. title: '碧欧泉男士净肤细致洁颜膏,泥状质地,有效清洁毛孔,带走油脂杂质,肌肤呈现哑光清透.现至网上商城在线购买,尊享独家满额臻礼!碧欧泉网上商城,全球护肤口碑之选.',
    56. money: '98',
    57. imgUrl: '../img/shop4.jpg',
    58. currency: '9800',
    59. sell: '98276'
    60. },
    61. {
    62. id: 4,
    63. title: '1.长的衣袖。多指舞衣。2.借指歌舞妓',
    64. money: '66',
    65. imgUrl: '../img/shop5.jpg',
    66. currency: '6200',
    67. sell: '18970'
    68. },
    69. ],
    70. },
    71. /**
    72. * 生命周期函数--监听页面加载
    73. */
    74. onLoad: function (options) {
    75. },
    76. /**
    77. * 生命周期函数--监听页面初次渲染完成
    78. */
    79. onReady: function () {
    80. },
    81. /**
    82. * 生命周期函数--监听页面显示
    83. */
    84. onShow: function () {
    85. },
    86. /**
    87. * 生命周期函数--监听页面隐藏
    88. */
    89. onHide: function () {
    90. },
    91. /**
    92. * 生命周期函数--监听页面卸载
    93. */
    94. onUnload: function () {
    95. },
    96. /**
    97. * 页面相关事件处理函数--监听用户下拉动作
    98. */
    99. onPullDownRefresh: function () {
    100. console.log('3333')
    101. },
    102. /**
    103. * 页面上拉触底事件的处理函数
    104. */
    105. onReachBottom: function () {
    106. let that = this;
    107. let arr = [
    108. {
    109. id:0,
    110. title:'灯,照明用品,泛指可以照亮的用具。人类远古时代用火把照明,后来有了蜡烛和油灯',
    111. money:'199',
    112. imgUrl:'../img/shop1.jpg',
    113. currency:'17890',
    114. sell:'12860'
    115. },
    116. {
    117. id: 1,
    118. title: '花,汉语常用字,读作huā,最早见于金文,其本义是花朵,后引申为像花的东西、错杂的颜色、虚伪的、模糊不清、用掉等义',
    119. money: '128',
    120. imgUrl: '../img/shop2.jpg',
    121. currency: '18908',
    122. sell: '12900'
    123. },
    124. {
    125. id: 2,
    126. title: '宝石(jewel)指那种经过琢磨和抛光后,可以达到珠宝要求的石料或矿物装嵌。',
    127. money: '3988',
    128. imgUrl: '../img/shop3.gif',
    129. currency: '550000',
    130. sell: '1289'
    131. },
    132. {
    133. id: 3,
    134. title: '碧欧泉男士净肤细致洁颜膏,泥状质地,有效清洁毛孔,带走油脂杂质,肌肤呈现哑光清透.现至网上商城在线购买,尊享独家满额臻礼!碧欧泉网上商城,全球护肤口碑之选.',
    135. money: '98',
    136. imgUrl: '../img/shop4.jpg',
    137. currency: '9800',
    138. sell: '98276'
    139. },
    140. {
    141. id: 4,
    142. title: '1.长的衣袖。多指舞衣。2.借指歌舞妓',
    143. money: '66',
    144. imgUrl: '../img/shop5.jpg',
    145. currency: '6200',
    146. sell: '18970'
    147. },
    148. ];
    149. that.setData({
    150. items: that.data.items.concat(arr)
    151. })
    152. // console.log(that.data.items)
    153. },
    154. /**
    155. * 用户点击右上角分享
    156. */
    157. onShareAppMessage: function () {
    158. },
    159. /***
    160. * 点击进入详情页
    161. * ***/
    162. toDetail:function(e){
    163. console.log(e)
    164. wx.navigateTo({
    165. url: '../detail/detail',
    166. })
    167. }
    168. })

  • 相关阅读:
    音乐APP首页框架搭建
    SM5308移动电源芯片
    链式二叉树的基本操作实现
    ForkJoinPool的使用及基本原理
    【C语言】程序环境和预处理
    在IDEA中使用Git
    计算机毕业设计django基于python大学生多媒体学习系统(源码+系统+mysql数据库+Lw文档)
    【PTHREAD】线程互斥与同步之条件变量
    WEB3 solidity 带着大家编写测试代码 操作订单 创建/取消/填充操作
    Nodejs后端接口项目「可供练手」
  • 原文地址:https://blog.csdn.net/hanjiepo/article/details/133253977