Commit 76efde28 by fengzhaoyu

11

parents 72b5a187 e39c15ff
...@@ -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) {
// 页面加载 // 页面加载
...@@ -26,8 +27,8 @@ Page({ ...@@ -26,8 +27,8 @@ Page({
}) })
}, },
onShow() { onShow() {
// 页面显示 // 页面显示
let data = { let data = {
"startTime": "2020-01-01 00:00:00", "startTime": "2020-01-01 00:00:00",
"endTime": "2025-12-30 23:59:59" "endTime": "2025-12-30 23:59:59"
} }
...@@ -42,18 +43,29 @@ Page({ ...@@ -42,18 +43,29 @@ 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))
} }
const today = new Date() if (this.data.isFirstLoad){
const finalDate = new Date(today) const today = new Date()
finalDate.setDate(today.getDate() - today.getDay()) const finalDate = new Date(today)
console.log(finalDate.toLocaleDateString()) finalDate.setDate(today.getDate() - today.getDay())
that.setData({ console.log(finalDate.toLocaleDateString())
scheduleList: scheduleList, that.setData({
todayStr: finalDate.toLocaleDateString(), scheduleList: scheduleList,
thisYear: year, todayStr: finalDate.toLocaleDateString(),
maxYear: year, thisYear: year,
canClick: true, maxYear: year,
startPageOnShow: true 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