Commit 264f202f by 李伟康

commit 话术质检默认前一天

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