Commit 264f202f by 李伟康

commit 话术质检默认前一天

1 parent 3c05ae04
......@@ -114,11 +114,13 @@ class Calendar {
let [next_year, next_month, next_day] = allowSameDay ? today.split(separator) : nextDay.split(separator)
for (let i = 1; i <= days; i++) {
let todayStr = `${year}${separator}${month}${separator}${now_day}`
let dayStr = `${year}${separator}${month}${separator}${i < 10 ? `0${i}` : i}`
let dayStr = `${year}${separator}${month}${separator}${i < 10 ? `0${i}` : i}`,
time = new Date(`${year}/${month}/${i}`).getTime()
let obj = {
day: i,
data: dayStr,
active: now_year == year && now_month == month && i == Number(now_day)
active: now_year == year && now_month == month && i == Number(now_day),
time
}
if ((minDate && Date.parse(minDate) > Date.parse(dayStr)) || (maxDate && Date.parse(maxDate) < Date.parse(dayStr))) obj.disable = true
if (dateType === 'multiple') multipleDate.push(todayStr)
......
......@@ -20,10 +20,11 @@ Page({
if (options.badgeId) this.loadData(options)
},
loadData(params) {
const day = new Date().setDate(new Date().getDate() - 1)
this.setData({
badgeId: params.badgeId
})
this.searchDate = new Date().format('yyyy-MM-dd')
this.searchDate = new Date(day).format('yyyy-MM-dd')
this.onLoadData()
},
onLoadData() {
......
// packageEquity/pages/aiInspection/components/dateBox/dateBox.js
const defaultDay = new Date().setDate(new Date().getDate() - 1)
Component({
/**
......@@ -16,7 +17,7 @@ Component({
* 组件的初始数据
*/
data: {
today: new Date().format('yyyy-MM-dd'),
maxDate: new Date().format('yyyy-MM-dd'),
},
......@@ -25,13 +26,15 @@ Component({
*/
methods: {
init() {
const now = new Date().format('yyyy/MM/dd')
const now = new Date().format('yyyy/MM/dd'),
calendar = this.selectComponent('#calendar')
this.setData({
currentDay: new Date().format('yyyy年MM月dd日'),
todayTime: new Date(now).getTime(),
minTime: new Date('2024/1/1').getTime(),
currentDayTime: new Date(now).getTime()
currentDay: new Date(defaultDay).format('yyyy年MM月dd日'),
maxDateTime: new Date(now).getTime(),
minTime: calendar.data.monthList[0].data[0].time,
currentDayTime: new Date(defaultDay).getTime()
})
calendar.resetData(new Date(defaultDay).format('yyyy-MM-dd'))
},
selectDay(e) {
let {
......
......@@ -9,7 +9,7 @@
{{currentDay}}
<gl-image class="icon" src="/equity/date-arrow.png" />
</view>
<block wx:if="{{todayTime != currentDayTime}}">
<block wx:if="{{maxDateTime != currentDayTime}}">
<view class="date-btn next" bindtap="choose" data-index="1">
下一天
<gl-image class="icon" src="/equity/arrow-right.png" />
......@@ -17,5 +17,5 @@
</block>
</view>
<calendar shortcut bindselect='selectDay' calenderColor='#347BFF' vertical minDate="2024-1-1" isComponents id="calendar" maxDate="{{today}}" >
<calendar shortcut bindselect='selectDay' calenderColor='#347BFF' vertical isComponents id="calendar" maxDate="{{maxDate}}" >
</calendar>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!