微信小程序商业级开发实战周记(二)

微信小程序商业级开发实战周记(二)

流行

主要功能

在这里插入图片描述
该页面主要展示比较热门的书籍,需要实现的功能如下:
1、书籍基本信息显示
需要显示的有标题、序号以及发布时间
.wxml文件

<view class="container">
  <view class="index-container">
    <text class="plain">No.</text>
    <text class="index">{{_index}}</text>
    <view class="vertical-line"></view>
  </view>
    <view class="date"> 
     <text class="month">{{month}}</text> 
    <text class="year">{{year}}</text>
   </view>  
</view>

.js文件

Component({
  properties: {
    index:{
      type: Number,
      observer:function(newVal, oldVal, changedPath){
        if (newVal < 10) {
          this.setData({
            _index: '0' + newVal
          })
        }
      }
    }
  },

  /**
   * 组件的初始数据, data 的值也会被页面绑定, 但data的值不可以从组件外部设置
   * 使用text组件会出现双文字的情况
   */
  data: {
      months:[
        '一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月',
        '十二月'
      ],
      year:Number,
      month:String,
      _index:String
  },

  ready:function(){
    let date = new Date()
    let month = date.getMonth()
    let year = date.getFullYear()
    this.setData({
      month:this.data.months[month],
      year:year
    })
  },

  methods: {
  }
})

2、点赞及分享功能
使用已有功能,点赞及跳转至推送页面
在这里插入图片描述

书单

主要功能

搜索页面和展示页面的切换,以及历史搜索和热门搜索的展示
在这里插入图片描述.wxml文件

<view class="container">
  <view class="header">
    <view class="search-container">
      <image class="icon" src="images/search.png" />
      <input placeholder-class='in-bar' placeholder='书籍名' class='bar' bind:confirm="onConfirm" value="{{q}}" auto-focus="true" />
      <image bind:tap="onDelete" class="cancel-img" src="images/cancel.png" />
    </view>
    <view class='cancel' bind:tap="onCancel">取消</view>
  </view>
  <view wx:if="{{!finished}}">
    <view class="history">
      <view class="title">
        <view class="chunk"></view>
        <text>历史搜索</text>
      </view>
      <view class="tags">
        <tag-cmp bind:tapping="onConfirm" wx:for="{{historyKeys}}" text="{{item}}" />
      </view>
    </view>
    <view class="history hot-search">
      <view class="title">
        <view class="chunk"></view>
        <text>热门搜索</text>
      </view>
        <view class="tags">
          <tag-cmp bind:tapping="onConfirm" wx:for="{{hotKeys}}" text="{{item}}" />
        </view>
    </view>
  </view>
  <view class="books-container" wx:if="{{finished}}">
    <block wx:for="{{dataArray}}" wx:key="{{item.id}}">
      <book-cmp show-like="{{false}}" book="{{item}}" class="book" />
    </block>
  </view>
  <loading-cmp class="loading" wx:if="{{loading}}" />
  <loading-cmp class="loading-center" wx:if="{{loadingCenter}}" />
  <text wx:if="{{empty}}" class="empty-tip">没有搜索到书籍</text>
</view>

此文仅为个人对一周学习的记录,侵删

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值