Commit e39c15ff by liang ce

首页接口

parent d3f4c80d
...@@ -30,10 +30,8 @@ Component({ ...@@ -30,10 +30,8 @@ Component({
var weekList = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'] var weekList = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
var w = weekList[date.getDay()]; var w = weekList[date.getDay()];
var h = date.getHours()<10? "0"+date.getHours() : date.getHours(); var h = date.getHours()<10? "0"+date.getHours() : date.getHours();
var min = date.getMinutes()<10? "0"+date.getMinutes() :date.getMinutes(); 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}`)] 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({ this.setData({
pickerValue: pickerValue, pickerValue: pickerValue,
time: this.props.time time: this.props.time
......
...@@ -10,7 +10,8 @@ Page({ ...@@ -10,7 +10,8 @@ Page({
minYear: '', minYear: '',
isClicked:false, isClicked:false,
startPageOnLoad: false, startPageOnLoad: false,
startPageOnShow: false startPageOnShow: false,
isFirstLoad: true
}, },
onLoad(query) { onLoad(query) {
// 页面加载 // 页面加载
...@@ -42,6 +43,7 @@ Page({ ...@@ -42,6 +43,7 @@ Page({
for (let i = 0; i<= year - 2019; i++) { for (let i = 0; i<= year - 2019; i++) {
scheduleList.push(that.returnScheduleList(2019 + i)) scheduleList.push(that.returnScheduleList(2019 + i))
} }
if (this.data.isFirstLoad){
const today = new Date() const today = new Date()
const finalDate = new Date(today) const finalDate = new Date(today)
finalDate.setDate(today.getDate() - today.getDay()) finalDate.setDate(today.getDate() - today.getDay())
...@@ -52,8 +54,18 @@ Page({ ...@@ -52,8 +54,18 @@ Page({
thisYear: year, thisYear: year,
maxYear: year, maxYear: year,
canClick: true, canClick: true,
startPageOnShow: true,
isFirstLoad: false
})
} else {
that.setData({
scheduleList: scheduleList,
thisYear: year,
maxYear: year,
canClick: true,
startPageOnShow: 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