スイッチで配信中のみを絞れるように
This commit is contained in:
parent
b906bf7c8e
commit
e5bd0308fe
|
|
@ -7,6 +7,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
||||||
<MkSpacer :contentMax="900">
|
<MkSpacer :contentMax="900">
|
||||||
|
<MkSwitch :modelValue="publishing" @update:modelValue="onChangePublishing">
|
||||||
|
{{ i18n.ts.publishing }}
|
||||||
|
</MkSwitch>
|
||||||
<div>
|
<div>
|
||||||
<div v-for="ad in ads" class="_panel _gaps_m" :class="$style.ad">
|
<div v-for="ad in ads" class="_panel _gaps_m" :class="$style.ad">
|
||||||
<MkAd v-if="ad.url" :specify="ad"/>
|
<MkAd v-if="ad.url" :specify="ad"/>
|
||||||
|
|
@ -75,6 +78,7 @@ import MkInput from '@/components/MkInput.vue';
|
||||||
import MkTextarea from '@/components/MkTextarea.vue';
|
import MkTextarea from '@/components/MkTextarea.vue';
|
||||||
import MkRadios from '@/components/MkRadios.vue';
|
import MkRadios from '@/components/MkRadios.vue';
|
||||||
import MkFolder from '@/components/MkFolder.vue';
|
import MkFolder from '@/components/MkFolder.vue';
|
||||||
|
import MkSwitch from '@/components/MkSwitch.vue';
|
||||||
import FormSplit from '@/components/form/split.vue';
|
import FormSplit from '@/components/form/split.vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
|
@ -86,8 +90,9 @@ let ads: any[] = $ref([]);
|
||||||
const localTime = new Date();
|
const localTime = new Date();
|
||||||
const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000;
|
const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000;
|
||||||
const daysOfWeek: string[] = [i18n.ts._weekday.sunday, i18n.ts._weekday.monday, i18n.ts._weekday.tuesday, i18n.ts._weekday.wednesday, i18n.ts._weekday.thursday, i18n.ts._weekday.friday, i18n.ts._weekday.saturday];
|
const daysOfWeek: string[] = [i18n.ts._weekday.sunday, i18n.ts._weekday.monday, i18n.ts._weekday.tuesday, i18n.ts._weekday.wednesday, i18n.ts._weekday.thursday, i18n.ts._weekday.friday, i18n.ts._weekday.saturday];
|
||||||
|
let publishing = false;
|
||||||
|
|
||||||
os.api('admin/ad/list').then(adsResponse => {
|
os.api('admin/ad/list',{publishing:publishing}).then(adsResponse => {
|
||||||
ads = adsResponse.map(r => {
|
ads = adsResponse.map(r => {
|
||||||
const exdate = new Date(r.expiresAt);
|
const exdate = new Date(r.expiresAt);
|
||||||
const stdate = new Date(r.startsAt);
|
const stdate = new Date(r.startsAt);
|
||||||
|
|
@ -101,6 +106,10 @@ os.api('admin/ad/list').then(adsResponse => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const onChangePublishing = (v) => {
|
||||||
|
publishing = v;
|
||||||
|
refresh();
|
||||||
|
};
|
||||||
// 選択された曜日(index)のビットフラグを操作する
|
// 選択された曜日(index)のビットフラグを操作する
|
||||||
function toggleDayOfWeek(ad, index) {
|
function toggleDayOfWeek(ad, index) {
|
||||||
ad.dayOfWeek ^= 1 << index;
|
ad.dayOfWeek ^= 1 << index;
|
||||||
|
|
@ -131,6 +140,8 @@ function remove(ad) {
|
||||||
if (ad.id == null) return;
|
if (ad.id == null) return;
|
||||||
os.apiWithDialog('admin/ad/delete', {
|
os.apiWithDialog('admin/ad/delete', {
|
||||||
id: ad.id,
|
id: ad.id,
|
||||||
|
}).then(() => {
|
||||||
|
refresh();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +183,7 @@ function save(ad) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function more() {
|
function more() {
|
||||||
os.api('admin/ad/list', { untilId: ads.reduce((acc, ad) => ad.id != null ? ad : acc).id }).then(adsResponse => {
|
os.api('admin/ad/list', { untilId: ads.reduce((acc, ad) => ad.id != null ? ad : acc).id,publishing:publishing }).then(adsResponse => {
|
||||||
ads = ads.concat(adsResponse.map(r => {
|
ads = ads.concat(adsResponse.map(r => {
|
||||||
const exdate = new Date(r.expiresAt);
|
const exdate = new Date(r.expiresAt);
|
||||||
const stdate = new Date(r.startsAt);
|
const stdate = new Date(r.startsAt);
|
||||||
|
|
@ -188,7 +199,7 @@ function more() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
os.api('admin/ad/list').then(adsResponse => {
|
os.api('admin/ad/list',{publishing:publishing}).then(adsResponse => {
|
||||||
ads = adsResponse.map(r => {
|
ads = adsResponse.map(r => {
|
||||||
const exdate = new Date(r.expiresAt);
|
const exdate = new Date(r.expiresAt);
|
||||||
const stdate = new Date(r.startsAt);
|
const stdate = new Date(r.startsAt);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue