2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2022-06-20 17:38:49 +09:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-19 16:20:53 +09:00
|
|
|
<MkSpacer :contentMax="800">
|
2023-07-28 00:29:33 +09:00
|
|
|
<MkPagination v-slot="{items, reload}" :pagination="pagination" class="ruryvtyk _gaps_m">
|
2023-07-24 13:08:39 +09:00
|
|
|
<section v-for="(announcement, i) in items" :key="announcement.id" :class="{ announcement: true, _panel: true, private: announcement.isPrivate }">
|
|
|
|
<div class="header"><span v-if="$i && !announcement.isRead"><span class="ti ti-speakerphone"></span></span><Mfm :text="announcement.title"/></div>
|
2023-01-06 09:41:14 +09:00
|
|
|
<div class="content">
|
2022-06-20 17:38:49 +09:00
|
|
|
<Mfm :text="announcement.text"/>
|
|
|
|
<img v-if="announcement.imageUrl" :src="announcement.imageUrl"/>
|
|
|
|
</div>
|
2023-01-06 09:41:14 +09:00
|
|
|
<div v-if="$i && !announcement.isRead" class="footer">
|
2023-07-28 00:29:33 +09:00
|
|
|
<MkButton primary @click="read(items, reload, announcement, i)"><i class="ti ti-check"></i> {{ i18n.ts.gotIt }}</MkButton>
|
2022-06-20 17:38:49 +09:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</MkPagination>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
<script lang="ts" setup>
|
2022-09-06 18:21:49 +09:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import * as os from '@/os';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2023-04-01 13:52:07 +09:00
|
|
|
import { $i } from '@/account';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const pagination = {
|
|
|
|
endpoint: 'announcements' as const,
|
2023-07-28 00:29:33 +09:00
|
|
|
offsetMode: true,
|
2022-06-20 17:38:49 +09:00
|
|
|
limit: 10,
|
|
|
|
};
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2023-07-28 00:29:33 +09:00
|
|
|
function read(items, reload, announcement, i) {
|
|
|
|
items[i].isRead = true;
|
|
|
|
os.api('i/read-announcement', {
|
|
|
|
announcementId: announcement.id,
|
|
|
|
}).then(reload);
|
2022-06-20 17:38:49 +09:00
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.announcements,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-speakerphone',
|
2020-01-30 04:37:25 +09:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2022-12-27 18:29:39 +09:00
|
|
|
<style lang="scss" scoped>
|
2020-01-30 04:37:25 +09:00
|
|
|
.ruryvtyk {
|
2023-07-24 13:08:39 +09:00
|
|
|
|
|
|
|
> .private {
|
|
|
|
border-left: 4px solid olivedrab;
|
|
|
|
}
|
|
|
|
|
2020-01-30 04:37:25 +09:00
|
|
|
> .announcement {
|
2023-01-07 19:57:48 +09:00
|
|
|
padding: 16px;
|
|
|
|
|
2023-01-06 09:41:14 +09:00
|
|
|
> .header {
|
2023-01-07 19:57:48 +09:00
|
|
|
margin-bottom: 16px;
|
2023-01-06 09:41:14 +09:00
|
|
|
font-weight: bold;
|
2021-10-25 00:13:54 +09:00
|
|
|
}
|
|
|
|
|
2023-01-06 09:41:14 +09:00
|
|
|
> .content {
|
2020-01-30 04:37:25 +09:00
|
|
|
> img {
|
|
|
|
display: block;
|
|
|
|
max-height: 300px;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
}
|
2023-01-06 09:41:14 +09:00
|
|
|
|
|
|
|
> .footer {
|
2023-01-07 19:57:48 +09:00
|
|
|
margin-top: 16px;
|
2023-01-06 09:41:14 +09:00
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
}
|
|
|
|
}
|
2023-07-24 13:08:39 +09:00
|
|
|
|
|
|
|
@keyframes fade {
|
|
|
|
0% {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
50% {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
100% {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
</style>
|