|
@@ -10,7 +10,7 @@
|
|
|
<view class="exam_times">
|
|
<view class="exam_times">
|
|
|
<view class="start_time all_time">
|
|
<view class="start_time all_time">
|
|
|
<view class="time_left">
|
|
<view class="time_left">
|
|
|
- <text class="numbers">{{ sDay > 1 ? parseInt(sDay) : 0 }}</text>
|
|
|
|
|
|
|
+ <text class="numbers">{{ startTime | getLastDay }}</text>
|
|
|
<text class="days">天</text>
|
|
<text class="days">天</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="words">距模考开始时间</view>
|
|
<view class="words">距模考开始时间</view>
|
|
@@ -18,7 +18,7 @@
|
|
|
<view class="lines"></view>
|
|
<view class="lines"></view>
|
|
|
<view class="end_time all_time">
|
|
<view class="end_time all_time">
|
|
|
<view class="time_left">
|
|
<view class="time_left">
|
|
|
- <text class="numbers">{{ sDay > 1 ? parseInt(eDay) : 0 }}</text>
|
|
|
|
|
|
|
+ <text class="numbers">{{ endTime | getLastDay }}</text>
|
|
|
<text class="days">天</text>
|
|
<text class="days">天</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="words">距模考结束时间</view>
|
|
<view class="words">距模考结束时间</view>
|
|
@@ -102,15 +102,38 @@ export default {
|
|
|
eDay: '',
|
|
eDay: '',
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ filters: {
|
|
|
|
|
+ getLastDay(time) {
|
|
|
|
|
+ console.log('time:', time)
|
|
|
|
|
+ var padDate = function (va) {
|
|
|
|
|
+ va = va < 10 ? '0' + va : va
|
|
|
|
|
+ return va
|
|
|
|
|
+ }
|
|
|
|
|
+ if (time) {
|
|
|
|
|
+ var value = new Date(time * 1000) //时间戳为10位需*1000,时间戳为13位的话不需乘1000
|
|
|
|
|
+ var year = value.getFullYear()
|
|
|
|
|
+ var month = padDate(value.getMonth() + 1)
|
|
|
|
|
+ var day = padDate(value.getDate())
|
|
|
|
|
+ let t_value = year + '/' + month + '/' + day
|
|
|
|
|
+ console.log('t:', t_value)
|
|
|
|
|
+ let curTimeLast = new Date(new Date(t_value).toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1
|
|
|
|
|
+
|
|
|
|
|
+ let lastStartDay = parseInt(curTimeLast/1000) - parseInt(curTime/1000)
|
|
|
|
|
+ let days = parseInt(lastStartDay/24/60/60)
|
|
|
|
|
+ return days >= 1 ? days : 0
|
|
|
|
|
+ // this.lastEndDay = parseInt(curTimeLast/1000) - parseInt(curTime/1000)
|
|
|
|
|
+ // this.sDay = this.lastStartDay/24/60/60
|
|
|
|
|
+ // this.eDay = this.lastEndDay/24/60/60
|
|
|
|
|
+ // console.log('lastStartDay', this.lastStartDay, this.lastEndDay, this.sDay, this.eDay)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
|
console.log('option: ', option)
|
|
console.log('option: ', option)
|
|
|
this.startTime = option.startTime
|
|
this.startTime = option.startTime
|
|
|
this.endTime = option.endTime
|
|
this.endTime = option.endTime
|
|
|
- this.lastStartDay = option.startTime - parseInt(curTime/1000)
|
|
|
|
|
- this.lastEndDay = option.endTime - parseInt(curTime/1000)
|
|
|
|
|
- this.sDay = this.lastStartDay/24/60/60
|
|
|
|
|
- this.eDay = this.lastEndDay/24/60/60
|
|
|
|
|
- console.log('lastStartDay', this.lastStartDay, this.lastEndDay, this.sDay, this.eDay)
|
|
|
|
|
|
|
+ // this.startTime = "1663041599"
|
|
|
|
|
+ // this.endTime = "1663127999"
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|