2020-01-29 11:37:25 -08:00
|
|
|
<template>
|
2022-06-20 01:38:49 -07:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
|
|
|
<MkSpacer :content-max="800">
|
2023-01-05 16:41:14 -08:00
|
|
|
<MkPagination v-slot="{items}" :pagination="pagination" class="ruryvtyk _autoGap">
|
|
|
|
<section v-for="(announcement, i) in items" :key="announcement.id" class="announcement _panel">
|
|
|
|
<div class="header"><span v-if="$i && !announcement.isRead">🆕 </span>{{ announcement.title }}</div>
|
|
|
|
<div class="content">
|
2022-06-20 01:38:49 -07:00
|
|
|
<Mfm :text="announcement.text"/>
|
|
|
|
<img v-if="announcement.imageUrl" :src="announcement.imageUrl"/>
|
|
|
|
</div>
|
2023-01-05 16:41:14 -08:00
|
|
|
<div v-if="$i && !announcement.isRead" class="footer">
|
2022-12-19 02:01:30 -08:00
|
|
|
<MkButton primary @click="read(items, announcement, i)"><i class="ti ti-check"></i> {{ $ts.gotIt }}</MkButton>
|
2022-06-20 01:38:49 -07:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</MkPagination>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2020-01-29 11:37:25 -08:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 01:38:49 -07:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2022-09-06 02:21:49 -07:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2021-11-11 09:02:25 -08:00
|
|
|
import * as os from '@/os';
|
2022-06-20 01:38:49 -07:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2022-06-20 01:38:49 -07:00
|
|
|
const pagination = {
|
|
|
|
endpoint: 'announcements' as const,
|
|
|
|
limit: 10,
|
|
|
|
};
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2022-06-20 01:38:49 -07:00
|
|
|
// TODO: これは実質的に親コンポーネントから子コンポーネントのプロパティを変更してるのでなんとかしたい
|
|
|
|
function read(items, announcement, i) {
|
|
|
|
items[i] = {
|
|
|
|
...announcement,
|
|
|
|
isRead: true,
|
|
|
|
};
|
|
|
|
os.api('i/read-announcement', { announcementId: announcement.id });
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2022-06-20 01:38:49 -07:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.announcements,
|
2022-12-19 02:01:30 -08:00
|
|
|
icon: 'ti ti-speakerphone',
|
2020-01-29 11:37:25 -08:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2022-12-27 01:29:39 -08:00
|
|
|
<style lang="scss" scoped>
|
2020-01-29 11:37:25 -08:00
|
|
|
.ruryvtyk {
|
|
|
|
> .announcement {
|
2023-01-05 16:41:14 -08:00
|
|
|
> .header {
|
|
|
|
padding: 16px;
|
|
|
|
font-weight: bold;
|
2021-10-24 08:13:54 -07:00
|
|
|
}
|
|
|
|
|
2023-01-05 16:41:14 -08:00
|
|
|
> .content {
|
|
|
|
padding: 0 16px;
|
|
|
|
|
2020-01-29 11:37:25 -08:00
|
|
|
> img {
|
|
|
|
display: block;
|
|
|
|
max-height: 300px;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
}
|
2023-01-05 16:41:14 -08:00
|
|
|
|
|
|
|
> .footer {
|
|
|
|
padding: 16px;
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|