反馈更改

dev
lion 2 months ago
parent 6af016fe51
commit ec73727772

@ -10,15 +10,15 @@
<view class="weekdays">
<text v-for="(d, wi) in weekNames" :key="wi" class="weekday">{{ d }}</text>
</view>
<view ref="grid" class="grid" :style="'height:' + gridHeightPx + 'rpx'">
<!-- :style="'height:' + gridHeightPx + 'rpx'" -->
<view ref="grid" class="grid">
<!-- 日期格子 -->
<view class="row" v-for="(row, rIdx) in weeks" :key="rIdx">
<view class="cell" v-for="cell in row" :key="cell.fullDate" @tap="onDayClick(cell.fullDate)">
<view class="cell" v-for="cell in row" :key="cell.fullDate" :style="'height:'+cellHeight+'rpx'" @tap="onDayClick(cell.fullDate)">
<text class="date-num" :class="{ dim: !cell.inMonth }">{{ cell.date }}</text>
<view class="cell-events">
<view v-for="ev in eventsForDate(cell.fullDate)" :key="ev.id" class="event-chip" :class="'event-type-' + (ev.type || 'default')">
{{ ev.title }}
<view v-for="ev in eventsForDate(cell.fullDate)" :key="ev.id" class="event-chip" :class="'event-type-' + (ev.type || 'default')" :style="ev && ev.color ? ('background:'+ev.color+';') : ''" @tap="onEventClick(ev)">
{{ formatTitle(ev.title) }}
</view>
</view>
</view>
@ -26,8 +26,8 @@
<!-- 跨天覆盖层 -->
<view class="overlay">
<view v-for="(seg, si) in continuousSegments" :key="si" class="continuous-bar" :style="'left:'+seg._style.left+';width:'+seg._style.width+';top:'+seg._style.top+';height:'+seg._style.height" :class="'event-type-' + (seg.type || 'default')" @tap="onEdit(seg.id)">
{{ seg.title }}
<view v-for="(seg, si) in continuousSegments" :key="si" class="continuous-bar" :style="'left:'+seg._style.left+';width:'+seg._style.width+';top:'+seg._style.top+';height:'+seg._style.height+';line-height:'+seg._style.height+';'+(seg.color?('background:'+seg.color+';'):'')" :class="'event-type-' + (seg.type || 'default')" @tap="onSegmentClick(seg)">
{{ formatTitle(seg.title) }}
</view>
</view>
</view>
@ -288,7 +288,8 @@ export default {
const leftPct = col * cellWidthPct
const widthPct = seg.spanCols * cellWidthPct
const vOffset = (seg.laneIndex || 0) * (this.barHeight + this.barSpacing)
const topRpx = (row * this.cellHeight) + this.dateNumberHeight + vOffset
const innerTopPadding = 8 //
const topRpx = (row * this.cellHeight) + this.dateNumberHeight + innerTopPadding + vOffset - 10
seg._style = {
left: leftPct + '%',
@ -302,6 +303,56 @@ export default {
}
},
methods: {
onEventClick(ev) {
this.$emit('eventClick', ev)
},
onSegmentClick(seg) {
this.$emit('eventClick', seg)
this.$emit('edit', seg.id)
},
formatTitle(title) {
const raw = (title == null ? '' : String(title)).trim()
if (!raw) return ''
// |-
if (raw.includes('') || raw.includes('|')) {
const pipeParts = raw.split(/[|]/).map(s => s.trim()).filter(Boolean)
const afterPipe = pipeParts.length ? pipeParts[pipeParts.length - 1] : raw
const core = afterPipe.split(/\s*[-—–-]\s*/)[0]
return core.trim()
}
//
const dashParts = raw.split(/\s*[-—–-]\s*/).map(s => s.trim()).filter(Boolean)
if (dashParts.length >= 3) {
// - -
return dashParts[Math.floor(dashParts.length / 2)]
}
if (dashParts.length === 2) {
//
return dashParts[0].length >= dashParts[1].length ? dashParts[0] : dashParts[1]
}
return raw
},
getEventChipStyle(ev) {
if (!ev) return {}
const custom = ev.color || ev.bg_color || ev.background
if (custom) return { background: custom, backgroundColor: custom }
return {}
},
getSegmentStyle(seg) {
if (!seg || !seg._style) return {}
const base = {
left: seg._style.left,
width: seg._style.width,
top: seg._style.top,
height: seg._style.height
}
const custom = seg.color || seg.bg_color || seg.background
if (custom) {
base.background = custom
base.backgroundColor = custom
}
return base
},
prevMonth() {
const d = new Date(this.baseDate)
d.setMonth(d.getMonth() - 1)
@ -362,10 +413,10 @@ export default {
<style scoped>
.calendar-grid {
background: #fff;
border-radius: 18rpx;
// border-radius: 18rpx;
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
margin: 20rpx;
padding: 10rpx 0 20rpx 0;
/* margin: 20rpx;
padding: 10rpx 0 20rpx 0; */
}
.calendar-header {
position: relative;

@ -17,6 +17,7 @@
v-for="ev in eventsForDate(date)"
:key="ev._id"
:class="['event-item', getEventClass(ev, date)]"
:style="getEventInlineStyle(ev)"
:title="getEventTooltip(ev, date)"
@click.stop="openCreateModal('editor', ev.id)"
>
@ -30,10 +31,10 @@
<div class="continuous-events-overlay">
<div
v-for="event in getContinuousEvents()"
:key="`continuous-${event.id}-${event.weekStart}`"
:key="`continuous-${event.id}-${event.weekStartISO}-${event.startCol}`"
:class="['continuous-event', `event-type-${event.type || 'default'}`]"
:style="getContinuousEventStyle(event)"
:title="getEventTooltip(event, new Date(event.weekStart))"
:title="getEventTooltip(event, new Date(event.segStartISO))"
@click.stop="openCreateModal('editor', event.id)"
>
{{ event.title }}
@ -179,6 +180,20 @@ import addCalendar from './components/addCalendar.vue'
return `${event.title}\n时间${this.formatDateTime(event.start_time)} ~ ${this.formatDateTime(event.end_time)}`
}
},
getEventInlineStyle(event) {
//
if (event) {
const custom = event.color
if (custom) {
try { console.log('[Calendar] Single-day color applied:', event.id || event._id, custom) } catch (e) {}
return { background: custom }
}
// 使
const fallback = this.getEventTypeColor(event.type)
return { background: fallback }
}
return {}
},
getContinuousEvents() {
const FIRST_DOW = 0 // 0=Sunday to match :first-day-of-week="7" on el-calendar
const continuousEvents = []
@ -278,35 +293,38 @@ import addCalendar from './components/addCalendar.vue'
const currentYear = this.calendarDate.getFullYear()
const firstDay = new Date(currentYear, currentMonth, 1)
// 7
const adjStart = new Date(event.segStartISO)
adjStart.setDate(adjStart.getDate() + 7)
// 使
const segStart = new Date(event.segStartISO)
const msPerDay = 1000 * 60 * 60 * 24
const daysFromFirstOfMonth = Math.floor((adjStart - firstDay) / msPerDay)
const daysFromFirstOfMonth = Math.floor((segStart - firstDay) / msPerDay)
const firstDayOffset = (firstDay.getDay() - FIRST_DOW + 7) % 7
const totalDaysFromCalendarStart = daysFromFirstOfMonth + firstDayOffset
const weekRow = Math.floor(totalDaysFromCalendarStart / 7)
// 使
const startColAdjusted = (adjStart.getDay() - FIRST_DOW + 7) % 7
// 使
const startColAdjusted = event.startCol
const cellWidth = 100 / 7
const cellHeight = 100
const headerHeight = 50
const headerHeight = 0
const cellPadding = 6 // td
const dateNumberHeight = 25
const eventHeight = 16
const eventSpacing = 2
const verticalOffset = (event.laneIndex || 0) * (eventHeight + eventSpacing)
const custom = event.color || event.bg_color || event.background
if (custom) { try { console.log('[Calendar] Continuous color applied:', event.id, custom) } catch (e) {} }
return {
position: 'absolute',
left: `calc(${startColAdjusted * cellWidth}% + 2px)`,
top: `${headerHeight + weekRow * cellHeight + dateNumberHeight + verticalOffset}px`,
top: `${headerHeight + weekRow * cellHeight + cellPadding + dateNumberHeight + verticalOffset}px`,
width: `calc(${event.spanCols * cellWidth}% - 4px)`,
height: `${eventHeight}px`,
zIndex: 1000,
background: `linear-gradient(90deg, ${this.getEventTypeColor(event.type)} 0%, ${this.darkenColor(this.getEventTypeColor(event.type))} 100%)`,
background: custom ? custom : `linear-gradient(90deg, ${this.getEventTypeColor(event.type)} 0%, ${this.darkenColor(this.getEventTypeColor(event.type))} 100%)`,
backgroundColor: custom ? custom : undefined,
borderRadius: '3px',
fontSize: '11px',
lineHeight: `${eventHeight}px`,
@ -498,22 +516,22 @@ import addCalendar from './components/addCalendar.vue'
.admin-header {
background: transparent;
padding: 20px 30px 10px 30px;
padding: 20rpx 30rpx 10rpx 30rpx;
border-bottom: none;
box-shadow: none;
}
.admin-main {
flex: 1;
padding: 20px 30px;
padding: 20rpx 30rpx;
overflow: hidden;
}
.calendar-panel {
background: #fff;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
padding: 24px;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
padding: 24rpx;
height: 100%;
overflow: auto;
}
@ -538,7 +556,7 @@ import addCalendar from './components/addCalendar.vue'
}
.continuous-event:hover {
transform: translateY(-1px);
transform: translateY(-1rpx);
filter: brightness(1.1);
z-index: 101;
}
@ -552,14 +570,14 @@ import addCalendar from './components/addCalendar.vue'
position: relative;
overflow: visible;
height: auto;
min-height: 100px;
padding: 4px;
min-height: 100rpx;
padding: 4rpx;
}
.calendar-panel ::v-deep .el-calendar-table td {
position: relative;
overflow: visible;
border: 1px solid #ebeef5;
border: 1rpx solid #ebeef5;
}
.calendar-panel ::v-deep .el-calendar-table tbody tr {
@ -572,17 +590,17 @@ import addCalendar from './components/addCalendar.vue'
.cell-content {
position: relative;
min-height: 100px;
min-height: 100rpx;
display: flex;
flex-direction: column;
padding: 2px;
padding: 2rpx;
overflow: visible;
}
.date-number {
font-weight: bold;
color: #333;
margin-bottom: 2px;
margin-bottom: 2rpx;
position: relative;
z-index: 1;
}
@ -595,10 +613,10 @@ import addCalendar from './components/addCalendar.vue'
}
.event-item {
font-size: 11px;
line-height: 14px;
padding: 1px 3px;
margin: 1px 0;
font-size: 11rpx;
line-height: 14rpx;
padding: 1rpx 3rpx;
margin: 1rpx 0;
background: #409EFF;
color: white;
border-radius: 3px;
@ -681,29 +699,29 @@ import addCalendar from './components/addCalendar.vue'
}
.event-item[style*="position: absolute"]:hover {
transform: translateY(-1px);
transform: translateY(-1rpx);
filter: brightness(1.1);
}
.mt-4 {
margin-top: 24px;
margin-top: 24rpx;
}
.mb-2 {
margin-bottom: 8px;
margin-bottom: 8rpx;
}
@media (max-width: 1200px) {
.admin-header {
padding: 15px 20px;
padding: 15rpx 20rpx;
}
.admin-main {
padding: 15px 20px;
padding: 15rpx 20rpx;
}
.calendar-panel {
padding: 16px;
padding: 16rpx;
}
}
</style>

@ -18,13 +18,14 @@
<CalendarGrid
:month="calendarDate"
:events="courses"
:rowHeightRpx="110"
:rowHeightRpx="170"
:headerHeightRpx="72"
:weekHeaderHeightRpx="52"
:dateNumberHeightRpx="46"
@dayClick="onDateChange"
@monthChange="onMonthSwitch"
@edit="onEditEvent"
@eventClick="showCourseDetail"
/>
</view>
<!-- 课程类型筛选 -->
@ -40,7 +41,7 @@
</view> -->
<!-- 当月日程列表 -->
<view class="month-events-container">
<view class="events-title">当月日程2</view>
<view class="events-title">当月日程</view>
<view v-if="monthEvents.length" class="events-list no-scroll">
<view
v-for="ev in monthEvents"
@ -89,8 +90,12 @@
<text class="info-value">{{ formatDateTime(detailData.end_time) }}</text>
</view>
</view>
<view class="course-description" v-if="detailData.address">
<text class="desc-title">日程地点</text>
<text class="info-value">{{ detailData.address }}</text>
</view>
<view class="course-description">
<text class="desc-title">日程详情</text>
<!-- <text class="desc-title">日程详情</text> -->
<!-- <u-parse :content="detailData.content || ''"></u-parse> -->
<view v-html="detailData.content || ''">
</view>
@ -330,7 +335,7 @@ export default {
.calendar-page {
min-height: 100vh;
background: #f8f9fa;
padding-bottom: 40rpx;
/* padding-bottom: 40rpx; */
}
.header {
background: #fff;
@ -399,15 +404,15 @@ export default {
background: #fff;
border-radius: 18rpx;
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
margin: 20rpx;
padding: 10rpx 0 20rpx 0;
/* margin: 20rpx;
padding: 10rpx 0 20rpx 0; */
}
.month-events-container {
margin: 20rpx;
margin-top: 20rpx;
padding: 20rpx;
background: #fff;
border-radius: 18rpx;
/* border-radius: 18rpx; */
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.events-title {
@ -443,6 +448,11 @@ export default {
border-radius: 50%;
flex-shrink: 0;
}
.type-dot.event-1 { background: #67C23A; }
.type-dot.event-2 { background: #409EFF; }
.type-dot.event-3 { background: #E6A23C; }
.type-dot.event-4 { background: #F56C6C; }
.type-dot.event-5 { background: #909399; }
.event-course { background: #1565c0; }
.event-activity { background: #6a1b9a; }
.event-workshop { background: #2e7d32; }
@ -540,7 +550,7 @@ export default {
}
@media (max-width: 768px) {
.course-modal { min-width: 90vw; }
.calendar-container { margin: 4rpx; }
/* .calendar-container { margin: 4rpx; } */
.header { padding: 8rpx 4rpx; }
.school-name { font-size: 28rpx; }
}

@ -99,8 +99,8 @@
<image :src="base.imgHost('btips.png')"></image>
</view>
<view class="birthday-button" @click="closeBirthdayPopup"></view>
</view>
</view>
</view>
</view>
</view>
</template>
@ -147,7 +147,7 @@ export default {
this.topNavHeight = menuButtonObject.height + 8;
//
this.hasShowBirthday = uni.getStorageSync("hasShowBirthday") || false;
this.hasShowBirthday = uni.getStorageSync("hasShowBirthday") || false;
let token = uni.getStorageSync("stbc1_lifeData")
? uni.getStorageSync("stbc1_lifeData").vuex_token

Loading…
Cancel
Save