找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 小程序开发 查看内容

微信小程序开发-模仿“优优老师”课程日历

作者:模板之家 2017-11-28 17:27 2279人关注

模仿优优老师APP的课程日历实现的Demo,只显示当月 和下个月两个月的日期,会根据不同类型的日期类型显示不一样的样式,在wx-swiper组件中动态添加了datePad,会根据要显示月份的日

模仿“优优老师APP”的课程日历实现的Demo,只显示当月 和下个月两个月的日期,会根据不同类型的日期类型显示不一样的样式,在wx-swiper组件中动态添加了datePad,会根据要显示月份的日 ...

 
 
 

模仿“优优老师APP”的课程日历实现的Demo,只显示<当月> 和<下个月>两个月的日期,会根据不同类型的日期类型显示不一样的样式,在wx-swiper组件中动态添加了datePad,会根据要显示月份的日期动态确定日期表格是4,5,还是6行,并动态改变swiper的高度,本月的第一天默认选中状态,下个月的第一天默认是选中状态。 
 

[效果展示]

[目录结构]

img:本地icon文件文件夹

course:课程日历代码的目录

utils:工具类文件夹

app.*:微信小程序全局配置文件

[贴代码]

course.wxml

 

[html] view plain copy
 
  1. <view class="container" style="background:#fff">  
  2.     <view class="container-hang" style="margin-top:23rpx;width:auto">  
  3.         <text wx:for="{{dateTitles}}" wx:for-item="dateItem" class="cellDate"  
  4.         style="width:{{titleCellWidth}}px;padding:6rpx 0 6rpx 0">{{dateItem}}</text>  
  5.     </view>  
  6.       
  7.     <swiper bindchange="swiperChange" class="swipter-box" duration="300" style="height:{{swiperHeight}}rpx">  
  8.         <swiper-item wx:for="{{monthDatas}}" wx:for-item="monthData">  
  9.   
  10.             <view class="cell-box" wx:for="{{monthData.dataHarr}}" wx:for-index="i">  
  11.                 <view wx:for="{{[0, 1, 2, 3, 4, 5, 6]}}" wx:for-index="j">  
  12.                     <view class="contentDate" style="width:{{dateCellWidth}}px;height:{{dateCellHeight}}rpx">  
  13.                         <view class="type_no_1_pad" wx:if="{{monthData.data[i*7 + j].type == -1}}">  
  14.                             <text class="type_no_1">{{monthData.data[i*7 + j].dateShow}}</text>  
  15.                         </view>  
  16.                         <view class="type_1_pad" wx:if="{{monthData.data[i*7 + j].type == 1}}">  
  17.                             <text class="type_1">{{monthData.data[i*7 + j].dateShow}}</text>  
  18.                         </view>  
  19.                         <view class="type_2_pad" wx:if="{{monthData.data[i*7 + j].type == 2}}">  
  20.                             <text class="type_2">{{monthData.data[i*7 + j].dateShow}}</text>  
  21.                         </view>  
  22.                     </view>  
  23.                 </view>  
  24.             </view>  
  25.   
  26.   
  27.         </swiper-item>  
  28.     </swiper>  
  29.   
  30.     <text style="width:{{windowWidth}}px;height:2rpx;background-color:#bdbdbd" />  
  31.   
  32.     <view style="display:flex;flex-direction:column;background:#fff;margin-top:53rpx;align-items:center">  
  33.         <image src="{{noclass_icon}}" style="width:105rpx;height:105rpx" />  
  34.         <text style="color:#d9d9d9;font-size:33rpx;margin-top:21rpx">今天没有课程哦~</text>  
  35.     </view>  
  36. </view>  


course.js:

 

[javascript] view plain copy
 
  1. var app = getApp()  

路过

雷人

握手

鲜花

鸡蛋
原作者: 模板之家 来自: 网络收集

全部回复(0)