From 3754a3e791f03101471aa10282b94dfc618220d2 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Mon, 29 Sep 2025 16:51:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/calendar-grid/calendar-grid.vue | 107 ++++++++++++---- .../calendar-widget/calendar-widget.vue | 34 +++-- packages/avatarUpload/index.vue | 2 +- packages/booksubmit/appointment.vue | 52 ++++---- packages/my/index.vue | 2 +- packages/schoolmate/index.vue | 3 +- pages/me/index.vue | 116 +++++++++--------- 7 files changed, 194 insertions(+), 122 deletions(-) diff --git a/components/calendar-grid/calendar-grid.vue b/components/calendar-grid/calendar-grid.vue index 2a385ec..b1a8974 100644 --- a/components/calendar-grid/calendar-grid.vue +++ b/components/calendar-grid/calendar-grid.vue @@ -17,7 +17,33 @@ {{ cell.date }} - + {{ formatTitle(ev.title) }} @@ -26,7 +52,7 @@ - + {{ formatTitle(seg.title) }} @@ -349,6 +375,15 @@ export default { this.laneCountByDate = laneCountByDate this.segCountByDate = segCountByDate + // 调试信息 + console.log('segCountByDate 统计结果:', segCountByDate) + console.log('所有跨天分段:', segs.map(seg => ({ + id: seg.id, + title: seg.title, + start: new Date(seg.segStartMs).toISOString().split('T')[0], + end: new Date(seg.segEndMs).toISOString().split('T')[0] + }))) + return segs } }, @@ -381,6 +416,40 @@ export default { return result }, + hasMultiDayCover(fullDate) { + // 直接基于当前计算出的连续分段判断该日期是否被任意跨天分段覆盖 + try { + const target = new Date(fullDate) + target.setHours(0,0,0,0) + const tMs = target.getTime() + const segs = this.continuousSegments || [] + for (let i = 0; i < segs.length; i += 1) { + const s = segs[i] + if (tMs >= s.segStartMs && tMs <= s.segEndMs) return true + } + return false + } catch (_) { + return false + } + }, + hasOtherEvents(fullDate) { + // 判断该日期是否有其他事件(包括跨天事件) + const singleEvents = this.eventsForDate(fullDate) || [] + const hasMultiDay = !!(this.segCountByDate && this.segCountByDate[fullDate] > 0) + const result = singleEvents.length > 1 || hasMultiDay + + // 调试信息 + if (fullDate.includes('25')) { + console.log(`日期 ${fullDate} 检查其他事件:`, { + singleEvents: singleEvents.length, + hasMultiDay, + segCount: this.segCountByDate ? this.segCountByDate[fullDate] : 'undefined', + result + }) + } + + return result + }, onEventClick(ev) { this.$emit('eventClick', ev) }, @@ -471,12 +540,6 @@ export default { if (isMulti) return false return d0.getTime() === s.getTime() }) - - // 调试信息 - if (result.length > 0) { - console.log(`日期 ${fullDate} 的单天事件:`, result) - } - return result }, pad2(n) { @@ -583,7 +646,6 @@ export default { font-weight: 600; color: #333; position: relative; - z-index: 3; text-align: center; width: 100%; margin-bottom: 4px; @@ -593,7 +655,6 @@ export default { } .cell-events { position: relative; - z-index: 2; /* 让跨天条位于其上方 */ width: 100%; overflow: hidden; } @@ -605,10 +666,11 @@ export default { color: #fff; border-radius: 16rpx; overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; max-width: 100%; box-sizing: border-box; + display: -webkit-box; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; } .event-chip.event-type-1 { background: #67C23A; } .event-chip.event-type-2 { background: #409EFF; } @@ -618,19 +680,20 @@ export default { .event-chip.event-type-default { background: #ddba99; } /* 当天只有一条单天事件时,允许换行不省略 */ .event-chip.single-line-open { - white-space: normal; - word-break: break-all; - text-overflow: ellipsis; - display: -webkit-box; -webkit-line-clamp: 3; /* 最多三行 */ - -webkit-box-orient: vertical; - overflow: hidden; +} + +/* 当天有其他事件时(多条单天事件或跨天事件),单条数据定位在底部 */ +.event-chip.single-line-open.has-other-events { + -webkit-line-clamp: 1; /* 强制一行 */ + position: absolute; + bottom: 0; + left: 0; + right: 0; } /* 与跨天冲突时,单日事件强制一行省略 */ .event-chip.conflict { - white-space: nowrap !important; - overflow: hidden !important; - text-overflow: ellipsis !important; + -webkit-line-clamp: 1 !important; } /* 当有跨天事件时,单天事件需要更多上边距 */ @@ -645,12 +708,10 @@ export default { right: 0; bottom: 0; pointer-events: none; - z-index: 4; /* 置于单日事件之上,避免被遮挡 */ } .continuous-bar { position: absolute; pointer-events: auto; - z-index: 2; color: #fff; font-size: 11px; line-height: 18px; diff --git a/components/calendar-widget/calendar-widget.vue b/components/calendar-widget/calendar-widget.vue index 0ba0b10..2aedbf6 100644 --- a/components/calendar-widget/calendar-widget.vue +++ b/components/calendar-widget/calendar-widget.vue @@ -150,53 +150,63 @@ export default { // 显示课程详情 showCourseDetail(ev) { - // 跳转逻辑: - // type=1 课程:直接跳转课程详情页面 - // type=3 自定义事件:弹出详情 - // type=4 资讯:跳 webview + // 交互规则: + // - 仅当存在“真实可展示内容”时才弹窗;仅有标题不弹窗 + // - 可跳转时仍按原逻辑跳转 const type = ev.type + + // 课程 if (type === 1) { if (ev.course_id) { uni.navigateTo({ url: `/packages/course/detail?id=${ev.course_id}` }) return } - // 没有 course_id 则显示基本信息 + // 无 course_id → 需要有开始时间或地点才弹窗 + const hasDetail = !!(ev.start_time || ev.location) + if (!hasDetail) return uni.showModal({ title: ev.title || '课程详情', - content: `时间:${ev.start_time}\n地点:${ev.location || '待定'}`, + content: `时间:${ev.start_time || '待定'}\n地点:${ev.location || '待定'}`, showCancel: false }) return } + // 自定义事件:需要 content 才弹 if (type === 3) { + const hasDetail = !!(ev.content && String(ev.content).trim()) + if (!hasDetail) return uni.showModal({ title: ev.title || '事件详情', - content: ev.content || '暂无详细信息', + content: ev.content, showCancel: false }) return } + // 资讯:有 url 跳转;否则需要 content 才弹 if (type === 4) { if (ev.url) { const encoded = ev.url uni.navigateTo({ url: `/packages/webview/index?type=3&url=${encoded}` }) return } - // 没有 url 则显示基本信息 + const hasDetail = !!(ev.content && String(ev.content).trim()) + if (!hasDetail) return uni.showModal({ title: ev.title || '资讯详情', - content: ev.content || '暂无详细信息', + content: ev.content, showCancel: false }) return } - - // 其他类型默认显示基本信息 + + // 其他类型:仅当有 content 才弹 + const hasDetail = !!(ev.content && String(ev.content).trim()) + if (!hasDetail) return uni.showModal({ title: ev.title || '详情', - content: ev.content || '暂无详细信息', + content: ev.content, showCancel: false }) } diff --git a/packages/avatarUpload/index.vue b/packages/avatarUpload/index.vue index a2fdb75..0103dd1 100644 --- a/packages/avatarUpload/index.vue +++ b/packages/avatarUpload/index.vue @@ -3,7 +3,7 @@ - + diff --git a/packages/booksubmit/appointment.vue b/packages/booksubmit/appointment.vue index 3716373..934a814 100644 --- a/packages/booksubmit/appointment.vue +++ b/packages/booksubmit/appointment.vue @@ -77,13 +77,13 @@ 入校请刷码:点击刷新二维码 - 预约时间:{{formatTime(myQrcode.start_time,myQrcode.end_time)}} - 预约场地: - - - {{site.real_name}}, - - + 预约时间:{{formatTime(myQrcode.start_time,myQrcode.end_time)}} + 预约场地: + + + {{site.real_name}}, + + @@ -153,19 +153,19 @@ getSites() { this.$u.api.otherConfig().then(res => { this.siteList = this.base.deepCopy(res.appointment_type) - this.siteList = this.siteList.sort((a, b) => a['sort'] - b['sort']) + this.siteList = this.siteList.sort((a, b) => a['sort'] - b['sort']) this.siteList = this.siteList.filter(item=>{return item.is_show===1}) }) - }, - formatTime(val1,val2) { - let val1Day = this.$moment(val1) - let val2Day = this.$moment(val2) - console.log("123",val1Day,val2Day) - if(val1Day.isSame(val2Day,'days')){ - return val1Day.format("YYYY-MM-DD") + ' ' + this.$moment(val1).format("HH:mm")+'-' + this.$moment(val2).format("HH:mm") - }else{ - return val1 + '至' + val2 - } + }, + formatTime(val1,val2) { + let val1Day = this.$moment(val1) + let val2Day = this.$moment(val2) + console.log("123",val1Day,val2Day) + if(val1Day.isSame(val2Day,'days')){ + return val1Day.format("YYYY-MM-DD") + ' ' + this.$moment(val1).format("HH:mm")+'-' + this.$moment(val2).format("HH:mm") + }else{ + return val1 + '至' + val2 + } }, // 判断已预约的日期是否大于或等于当前日期 isCurrentDateGreaterOrEqual(targetDate) { @@ -183,11 +183,11 @@ this.can_appointment = true } else { this.can_appointment = false - } - if(res.door_appointments){ - if (this.isCurrentDateGreaterOrEqual(res.door_appointments.start_time)) { - this.myQrcode = res.door_appointments - } + } + if(res.door_appointments){ + if (this.isCurrentDateGreaterOrEqual(res.door_appointments.start_time)) { + this.myQrcode = res.door_appointments + } } this.$u.vuex('vuex_user', res.user) }) @@ -266,8 +266,8 @@ justify-content: space-between; image { - width: 539rpx; - height: 88rpx; + width: 455rpx; + height: 87rpx; display: block; } @@ -411,7 +411,7 @@ text-align: center; width:100%; &>view { - margin-top: 20rpx; + margin-top: 20rpx; text-align: left; } } diff --git a/packages/my/index.vue b/packages/my/index.vue index 8ccab58..f0f00e4 100644 --- a/packages/my/index.vue +++ b/packages/my/index.vue @@ -5,7 +5,7 @@ - + diff --git a/packages/schoolmate/index.vue b/packages/schoolmate/index.vue index 9f25ebd..573bcdc 100644 --- a/packages/schoolmate/index.vue +++ b/packages/schoolmate/index.vue @@ -425,7 +425,7 @@ // top: 110rpx; // right: 20rpx; z-index: 999; - background-color: #b89155; + background-color: #EB0432; padding: 15rpx 20rpx; border-radius: 40rpx; display: flex; @@ -435,6 +435,7 @@ } .map-setting{ width:30%; + background-color: #b89155; } .map-text{ font-size: 28rpx; diff --git a/pages/me/index.vue b/pages/me/index.vue index 568bb3e..0b95174 100644 --- a/pages/me/index.vue +++ b/pages/me/index.vue @@ -10,16 +10,16 @@ - + 姓名: {{userInfo.username?userInfo.username:'-'}} - - - 学号: - {{userInfo.no?userInfo.no:'-'}} + + + 学号: + {{userInfo.no?userInfo.no:'-'}} @@ -30,9 +30,9 @@ - + - - @@ -120,23 +120,23 @@ margin: 10, foregroundImageSrc: '/static/index_icon1.png', }"> - - - - 点击二维码刷新 + + + + 点击二维码刷新 - - - + + + 姓名: {{userInfo.username}} - - - 学号: - {{userInfo.no?userInfo.no:'-'}} + + + 学号: + {{userInfo.no?userInfo.no:'-'}} @@ -203,7 +203,7 @@ }, data() { return { - showRegister: false, + showRegister: false, userAvatar:'', type: 'register', showGzh: false, @@ -265,11 +265,11 @@ bigCode() { this.showCard = false this.showBigCode = true - }, - changeAvatar(){ - uni.navigateTo({ - url:'/packages/avatarUpload/index' - }) + }, + changeAvatar(){ + uni.navigateTo({ + url:'/packages/avatarUpload/index' + }) }, toUrl(type) { if (type === 1 || type === 2 || type === 3) { @@ -311,7 +311,7 @@ this.$u.vuex('vuex_user', res.user) this.userInfo = res.user this.course_signs = res.user.course_signs ? res.user.course_signs : [] - this.myQrcode = res.course_signs ? res.course_signs.qrcode : 'STBC' + this.myQrcode = res.course_signs ? res.course_signs.qrcode : 'STBC' this.userAvatar = res.user.headimgurl?res.user.headimgurl:'' if (this.base.isNull(res.user.mobile)) { this.showRegister = true @@ -398,13 +398,13 @@ align-items: flex-start; justify-content: space-between; - &-left { - width:100%; - &>image { - width: 200rpx; - margin-bottom: 30rpx; - // height: 110rpx; - // margin-right: 20rpx; + &-left { + width:100%; + &>image { + width: 200rpx; + margin-bottom: 30rpx; + // height: 110rpx; + // margin-right: 20rpx; } .userinfo { line-height: 1.5; @@ -430,9 +430,9 @@ width: calc(100% - 100rpx); } } - } - .usercode { - width: 160rpx; + } + .usercode { + width: 160rpx; } } } @@ -571,7 +571,7 @@ display: flex; justify-content: space-between; align-items: flex-start; - padding: 20rpx 60rpx; + padding: 20rpx 60rpx; padding-left:30rpx; } @@ -583,8 +583,8 @@ &-reload { display: flex; align-items: center; - // padding: 10rpx 40rpx; - justify-content: center; + // padding: 10rpx 40rpx; + justify-content: center; margin-top: 20rpx; font-size: 24rpx; image { @@ -594,11 +594,11 @@ } } } - &-code{ - width: 270rpx; - /* margin-right: 10rpx; */ - border-right: 1rpx solid rgba(255,255,255,0.2); - padding-right: 30rpx; + &-code{ + width: 270rpx; + /* margin-right: 10rpx; */ + border-right: 1rpx solid rgba(255,255,255,0.2); + padding-right: 30rpx; } &-name { width: calc(100% - 310rpx); @@ -608,14 +608,14 @@ text-align: left; // margin-bottom: 20rpx; } - &-img{ - image{ - width: 100rpx; - height: 100rpx; - margin-left: 30rpx; - margin-bottom:10rpx; - border-radius: 100%; - } + &-img{ + image{ + width: 100rpx; + height: 100rpx; + margin-left: 30rpx; + margin-bottom:10rpx; + border-radius: 100%; + } } &-course { display: flex;