_placeList () {
placeList({
page: this.page,
size: this.size
// userId: localStorage.getItem('userId')
// userId: localStorage.getItem('nameid'),
// placeId: this.placeId
}).then(res => {
// console.log('res', res)
if (res.status === 200) {
let data = res.data.data
this.leftlists = data.dataList //左侧场地
for (let i = 0; i < 90; i++) {
this.leftlists1.push(this.getDay(i)) //右侧日期
}
this.dataList = data.dataList
}
})
},
getDay (day) {
const today = new Date()
const targetday_milliseconds =
today.getTime() + 1000 * 60 * 60 * 24 * day
today.setTime(targetday_milliseconds) // 注意,这行是关键代码
const tYear = today.getFullYear()
let tMonth = today.getMonth()
let tDate = today.getDate()
tMonth = this.doHandleMonth(tMonth + 1)
tDate = this.doHandleMonth(tDate)
// console.log(this.timeType)
return {
key: tYear + '-' + tMonth + '-' + tDate,
value: tMonth + '月' + tDate + '日'
}
},
doHandleMonth (month) {
let m = month
if (month.toString().length === 1) {
m = '0' + month
}
return m
},