Commit e39c15ff by liang ce

首页接口

parent d3f4c80d
......@@ -30,10 +30,8 @@ Component({
var weekList = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
var w = weekList[date.getDay()];
var h = date.getHours()<10? "0"+date.getHours() : date.getHours();
var min = date.getMinutes()<10? "0"+date.getMinutes() :date.getMinutes();
var pickerValue = [this.data.timeData.indexOf(y+"/"+m+"/"+d+" "+w),this.data.timeHour.indexOf(`${h}`),this.data.timeMin.indexOf(`${min}`)]
console.log(pickerValue)
this.setData({
pickerValue: pickerValue,
time: this.props.time
......
......@@ -10,7 +10,8 @@ Page({
minYear: '',
isClicked:false,
startPageOnLoad: false,
startPageOnShow: false
startPageOnShow: false,
isFirstLoad: true
},
onLoad(query) {
// 页面加载
......@@ -26,8 +27,8 @@ Page({
})
},
onShow() {
// 页面显示
let data = {
// 页面显示
let data = {
"startTime": "2020-01-01 00:00:00",
"endTime": "2025-12-30 23:59:59"
}
......@@ -42,18 +43,29 @@ Page({
for (let i = 0; i<= year - 2019; i++) {
scheduleList.push(that.returnScheduleList(2019 + i))
}
const today = new Date()
const finalDate = new Date(today)
finalDate.setDate(today.getDate() - today.getDay())
console.log(finalDate.toLocaleDateString())
that.setData({
scheduleList: scheduleList,
todayStr: finalDate.toLocaleDateString(),
thisYear: year,
maxYear: year,
canClick: true,
startPageOnShow: true
})
if (this.data.isFirstLoad){
const today = new Date()
const finalDate = new Date(today)
finalDate.setDate(today.getDate() - today.getDay())
console.log(finalDate.toLocaleDateString())
that.setData({
scheduleList: scheduleList,
todayStr: finalDate.toLocaleDateString(),
thisYear: year,
maxYear: year,
canClick: true,
startPageOnShow: true,
isFirstLoad: false
})
} else {
that.setData({
scheduleList: scheduleList,
thisYear: year,
maxYear: year,
canClick: true,
startPageOnShow: true
})
}
})
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment