fix:修复日记显示不全的问题
This commit is contained in:
@@ -5,8 +5,11 @@
|
||||
:is-dark="appStore.isDark"
|
||||
class="journal-calendar card-item"/>
|
||||
|
||||
<journal-card v-if="journalStore.currentJournal.id !== 0"
|
||||
:item="journalStore.currentJournal"/>
|
||||
<div v-if="journalStore.dateJournalList.length > 0"
|
||||
class="journal-list">
|
||||
<journal-card v-for="(item, index) in journalStore.dateJournalList"
|
||||
:key="index" :item="item"/>
|
||||
</div>
|
||||
|
||||
<el-empty v-else description="今日暂无日记" />
|
||||
</div>
|
||||
@@ -35,6 +38,7 @@ const dailyInfo = reactive({
|
||||
})
|
||||
|
||||
const updateInfo = () => {
|
||||
journalStore.dateJournalList = []
|
||||
getCalendarMoveDate()
|
||||
getCalendarAttrDates()
|
||||
}
|
||||
@@ -42,7 +46,7 @@ const updateInfo = () => {
|
||||
const getCalendarMoveDate = () => {
|
||||
const recordLength = journalStore.journalList.length
|
||||
if (recordLength > 0) {
|
||||
journalStore.currentJournal = getJournalDay(formatDate(new Date()))
|
||||
journalStore.dateJournalList = getJournalDay(formatDate(new Date()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +58,7 @@ const getCalendarAttrDates = () => {
|
||||
dates: new Date()
|
||||
})
|
||||
|
||||
const dateList = journalStore.journalList.map((item) => item.date)
|
||||
const dateList = journalStore.journalList.map((item) => formatDate(item.date))
|
||||
dailyInfo.attrs.push({
|
||||
dot: 'red',
|
||||
dates: [...new Set(dateList)]
|
||||
@@ -66,12 +70,11 @@ const getCalendarAttrDates = () => {
|
||||
* @param day 日期
|
||||
*/
|
||||
const dateClick = (day: CalendarDay) => {
|
||||
journalStore.currentJournal = getJournalDay(formatDate(day.date))
|
||||
journalStore.dateJournalList = getJournalDay(formatDate(day.date))
|
||||
}
|
||||
|
||||
const getJournalDay = (date: string): IJournal => {
|
||||
return journalStore.journalList.find((item) => formatDate(item.date) === date)
|
||||
|| journalStore.getEmptyJournal()
|
||||
const getJournalDay = (date: string): IJournal[] => {
|
||||
return journalStore.journalList.filter((item) => formatDate(item.date) === date) || []
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,5 +99,12 @@ const changeMonthClick = async (value) => {
|
||||
.journal-calendar {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.journal-list {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1vh;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -25,6 +25,7 @@ export const useJournalStore = defineStore('journal', {
|
||||
imageUrl: '',
|
||||
videoUrl: ''
|
||||
} as IJournal,
|
||||
dateJournalList: [] as IJournal[],
|
||||
journalImagePath: ImagePathEnum.JOURNAL,
|
||||
journalVideoPath: ImagePathEnum.JOURNAL,
|
||||
journalDialog: {
|
||||
|
||||
Reference in New Issue
Block a user