|
|
|
const {
|
|
|
|
httpUtil,
|
|
|
|
formatTime
|
|
|
|
} = require("../../../utils/util");
|
|
|
|
|
|
|
|
// pages/index/calendar/calendar.js
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
min_date: new Date().setDate(1),
|
|
|
|
max_date: new Date().setMonth((new Date().getMonth() + 6), 0),
|
|
|
|
today_:new Date().getTime(),
|
|
|
|
show_today:[]
|
|
|
|
},
|
|
|
|
|
|
|
|
select_date:function(event){
|
|
|
|
let day_ = event.detail.getDate()
|
|
|
|
let show_today=[]
|
|
|
|
for(let item of this.data.show_list){
|
|
|
|
if(day_==item.day){
|
|
|
|
show_today.push(item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.setData({show_today})
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
var that = this
|
|
|
|
var city_id=options.city_id
|
|
|
|
let cur_date = new Date()
|
|
|
|
let cur_year = cur_date.getFullYear()
|
|
|
|
let cur_month = cur_date.getMonth() + 1
|
|
|
|
httpUtil("/api/v1/lately-show" + "?city_id="+city_id + "&year=" + cur_year + "&month="+cur_month, "get").then(res => {
|
|
|
|
let show_list = res.show_list
|
|
|
|
let show_today=[]
|
|
|
|
for(let item of show_list){
|
|
|
|
if(new Date().getDate()==item.day){
|
|
|
|
show_today.push(item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
that.setData({
|
|
|
|
show_list,show_today,
|
|
|
|
formatter: function (day) {
|
|
|
|
const month = day.date.getMonth() + 1;
|
|
|
|
const date = day.date.getDate();
|
|
|
|
for (let item of show_list) {
|
|
|
|
if (month == cur_month) {
|
|
|
|
if (date == item.day) {
|
|
|
|
day.bottomInfo = " "
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (date === cur_date.getDate()&&month===cur_month) {
|
|
|
|
day.text = '今天';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return day;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|