From 9c6f47ee890787cce1111c19a9636c7f1860710f Mon Sep 17 00:00:00 2001 From: binbin_pan Date: Tue, 17 Dec 2024 19:16:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=B6=E9=97=B4=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/YNEduApp/exam/exam.vue | 12 +++++++----- pages/YNEduApp/learnProj/learnProjDetail.vue | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/pages/YNEduApp/exam/exam.vue b/pages/YNEduApp/exam/exam.vue index 9d29802..27fc69c 100644 --- a/pages/YNEduApp/exam/exam.vue +++ b/pages/YNEduApp/exam/exam.vue @@ -126,11 +126,13 @@ export default { console.log('πŸš€ ~ handleExamination ~ item:', item) // θŽ·ε–ε½“ε‰θ€ƒθ―•ι™εˆΆζ—Άι—΄ item.validityDate 2021-09-01~2021-09-30 ε¦‚ζžœδ»Šε€©δΈεœ¨θΏ™δΈͺθŒƒε›΄ε†…, 不能考试 const date = new Date() - const year = date.getFullYear() - const month = date.getMonth() + 1 - const day = date.getDate() - const today = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}` - if (today < item.validityDate.split('~')[0] || today > item.validityDate.split('~')[1]) { + const validityDate = item.validityDate.split('~') + const startDate = new Date(validityDate[0].trim()) + const endDate = new Date(validityDate[1].trim()) + console.log('πŸš€ ~ ζ—Άι—΄ ~ date:', date) + console.log('πŸš€ ~ ζ—Άι—΄ ~ startDate:', startDate) + console.log('πŸš€ ~ ζ—Άι—΄ ~ endDate:', endDate) + if (date < startDate || date > endDate) { uni.showToast({ title: 'ε½“ε‰ζ—Άι—΄δΈεœ¨θ€ƒθ―•ζ—Άι—΄θŒƒε›΄ε†…', icon: 'none' diff --git a/pages/YNEduApp/learnProj/learnProjDetail.vue b/pages/YNEduApp/learnProj/learnProjDetail.vue index fc08638..4f3e445 100644 --- a/pages/YNEduApp/learnProj/learnProjDetail.vue +++ b/pages/YNEduApp/learnProj/learnProjDetail.vue @@ -339,11 +339,13 @@ export default { toggleTheoryExam(item) { console.log('πŸš€ ~ toggleTheoryExam ~ item:', item, item.examMsg.examEquipment) const date = new Date() - const year = date.getFullYear() - const month = date.getMonth() + 1 - const day = date.getDate() - const today = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}` - if (today < item.examMsg.validityDate.split('~')[0] || today > item.examMsg.validityDate.split('~')[1]) { + const validityDate = item.examMsg.validityDate.split('~') + const startDate = new Date(validityDate[0].trim()) + const endDate = new Date(validityDate[1].trim()) + console.log('πŸš€ ~ ζ—Άι—΄ ~ date:', date) + console.log('πŸš€ ~ ζ—Άι—΄ ~ startDate:', startDate) + console.log('πŸš€ ~ ζ—Άι—΄ ~ endDate:', endDate) + if (date < startDate || date > endDate) { uni.showToast({ title: 'ε½“ε‰ζ—Άι—΄δΈεœ¨θ€ƒθ―•ζ—Άι—΄θŒƒε›΄ε†…', icon: 'none'