//logs.js
var util = require('../../utils/util.js')
Page({
data: {
tomonth: '',
love:false,
monthly:false,
danger:false,
list:[],
ymd:"",
modalHidden:"hidden",
selected_ymd:"",
selected_action:"",
},
onLoad: function (options) {
var that = this
this.title = options.title
tomonth = this.this_month()
that.setData({
tomonth:tomonth
})
that.draw_calendar(tomonth);
},
prev:function(e){
var that = this
var now = that.data.tomonth;
var arr = now.split('-');
var year,month
if (arr[1]-1 == 0) {//如果是1月份,则取上一年的12月份
year = arr[0] - 1;
month = 12;
}else{
year = arr[0];
month = arr[1]-1;
}
month =(month<10 ? "0"+month:month);
var tomonth = year+"-"+month;
that.setData({
tomonth:tomonth
})
that.draw_calendar(tomonth);
},
next:function(e){
var that = this
var now = that.data.tomonth;
var arr = now.split('-');
var year,month
if (arr[1]-0+1 == 13) {//如果是1月份,则取上一年的12月份
year = arr[0]-0+1;
month = 1;
}else{
year = arr[0];
month = arr[1]-0+1;
}
month =(month<10 ? "0"+month:month);
var tomonth = year+"-"+month;
that.setData({
tomonth:tomonth
})
that.draw_calendar(tomonth);
},
this_month:function(e){
var that = this;
var date=new Date;
var month=date.getMonth()+1;
month =(month<10 ? "0"+month:month);
var year=date.getFullYear();
var tomonth = year+"-"+month;
console.log(tomonth);
return tomonth;
},
draw_calendar: function (now) {
var arr = now.split('-');
year = arr[0];
month = arr[1];
var that = this;
var list = [];
var d = new Date(year,month-1,1,1,1,1);
console.log(d);
var firstDay = d.getDay();
var allDate = new Date(d.getFullYear(), (d.getMonth()+1), 0).getDate();
var ymd;
for(var i=0; i<firstDay;i++){
list.push({
ymd : "",
date : "",
love : false,
danger : false,
monthly : false,
today : false,
})
}
var j = 1;
var k = i;
for(i;i<allDate+k;i++){
var dd = new Date();
y = dd.getFullYear();
m = dd.getMonth()+1;//获取当前月份的日期
d = dd.getDate();
ymd = year+"-"+month+"-"+j;
if(year==y && month==m && d==j){
today = true;
that.setData({
ymd:ymd
})
}else{
today = false;
}
var action = wx.getStorageSync(ymd);
list.push({
ymd :ymd,
date : j,
love : action=="love"?true:false,
danger : false,
monthly : action=="monthly"?true:false,
today : today
})
j++;
}
var lastDay = new Date(year,month-1,allDate,1,1,1).getDay();
console.log(lastDay);
var k = i;
for(i; i<(6-lastDay+k);i++){
list.push({
ymd : "",
date : "",
love : false,
danger : false,
monthly : false,
today : 0,
})
}
that.setData({
list:list
})
},
love: function(e){
var action = wx.getStorageSync(this.data.ymd);
if(action=="monthly"){
this.setData({
modalHidden:""
})
return false;
}
var selected = e.currentTarget.dataset.selected
if(selected==1){
this.setData({
love:false,
})
wx.setStorageSync(this.data.ymd,"")
}else{
this.setData({
love:true,
})
wx.setStorageSync(this.data.ymd,"love")
}
this.draw_calendar(this.data.tomonth)
},
monthly: function(e){
var action = wx.getStorageSync(this.data.ymd);
if(action=="love"){
this.setData({
modalHidden:""
})
return false;
}
var selected = e.currentTarget.dataset.selected
if(selected==1){
this.setData({
monthly:false,
})
wx.setStorageSync(this.data.ymd,"")
}else{
this.setData({
monthly:true,
})
wx.setStorageSync(this.data.ymd,"monthly")
}
this.draw_calendar(this.data.tomonth)
},
selected_day: function(e){
ymd = e.currentTarget.dataset.ymd;
this.setData({
ymd:ymd
})
var action = wx.getStorageSync(ymd);
if(action=="monthly"){
this.setData({
monthly:true
})
}else{
this.setData({
monthly:false
})
}
if(action=="love"){
this.setData({
love:true
})
}else{
this.setData({
love:false
})
}
},
modalChange:function(e){
this.setData({
modalHidden:"hidden"
})
}
})
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
微信小程序凭借其独特的优势,在移动应用市场中占据了一席之地。首先,微信小程序无需下载安装,用户通过微信即可直接使用,极大地降低了使用门槛。其次,小程序拥有与原生应用相近的用户体验,同时加载速度快,响应迅速,保证了良好的使用感受。此外,微信小程序还提供了丰富的API接口,支持开发者轻松接入微信支付、用户授权等功能,为开发者提供了更多的可能性。 微信小程序-项目源码-原生开发框架。想要快速打造爆款小程序吗?这里有一份原生开发框架的项目源码等你来探索!基于微信小程序的强大生态,这份源码将带你领略原生开发的魅力,实现快速迭代与高效开发。从用户授权到微信支付,从界面设计到功能实现,一切尽在掌握。赶快下载查看,让你的小程序项目在竞争激烈的市场中脱颖而出!
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
共 9 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/196b0ad537b04e688a2a9ae3fce83c0a_black_cat7.jpg!1)
DTcode7
- 粉丝: 2w+
- 资源: 4986
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 元旦倒计时代码,动态网页基础
- 线控转向系统路感模拟及路感力矩控制 通过参数拟合设计线控转向路感模拟算法,在simulink中建立仿真模型 模型建
- 第二章 初识 IO 函数,初学者的笔记
- SSA-Catboost麻雀搜索算法优化Catboost分类预测,优化前后对比(Matlab完整源码和数据)
- 事件触发控制代码,每个代码有对应参考文献 1.多智能体中基于事件触发的协议 2.多智能体分布式系统的事件触发控制 3.基于观测器
- Python实现 ChatOps 的最简单最受欢迎的聊天机器人
- Python GraphQL 框架
- Emacs Python 开发环境
- 如何在Windows 11未检测到耳机时修复它
- HBA-Catboost蜜獾优化算法优化Catboost分类预测,优化前后对比(Matlab完整源码和数据)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)