日付のフォーマット指定と変更がうまくいかない
This commit is contained in:
parent
cd5615d354
commit
c8a81364ef
|
@ -1,10 +1,13 @@
|
|||
<template>
|
||||
<MkStickyContainer>
|
||||
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
||||
<MkStickyContainer>
|
||||
<template #header>
|
||||
<XHeader :actions="headerActions" :tabs="headerTabs" />
|
||||
</template>
|
||||
<MkSpacer :content-max="900">
|
||||
<div class="uqshojas">
|
||||
<div v-for="ad in ads" class="_panel _gaps_m ad">
|
||||
<MkAd v-if="ad.url" :specify="ad"/>
|
||||
<MkPagination v-slot="{ items }" :pagination="pagination" :on-vnode-updated="update()">
|
||||
<div v-for="ad in items" class="_panel _gaps_m ad">
|
||||
<MkAd v-if="ad.url" :specify="ad" />
|
||||
<MkInput v-model="ad.url" type="url">
|
||||
<template #label>URL</template>
|
||||
</MkInput>
|
||||
|
@ -40,13 +43,16 @@
|
|||
<template #label>{{ i18n.ts.memo }}</template>
|
||||
</MkTextarea>
|
||||
<div class="buttons">
|
||||
<MkButton class="button" inline primary style="margin-right: 12px;" @click="save(ad)"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
||||
<MkButton class="button" inline danger @click="remove(ad)"><i class="ti ti-trash"></i> {{ i18n.ts.remove }}</MkButton>
|
||||
<MkButton class="button" inline primary style="margin-right: 12px;" @click="save(ad)"><i
|
||||
class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
|
||||
<MkButton class="button" inline danger @click="remove(ad)"><i class="ti ti-trash"></i> {{ i18n.ts.remove }}
|
||||
</MkButton>
|
||||
</div>
|
||||
</div>
|
||||
</MkPagination>
|
||||
</div>
|
||||
</MkSpacer>
|
||||
</MkStickyContainer>
|
||||
</MkStickyContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
@ -56,6 +62,7 @@ import MkButton from '@/components/MkButton.vue';
|
|||
import MkInput from '@/components/MkInput.vue';
|
||||
import MkTextarea from '@/components/MkTextarea.vue';
|
||||
import MkRadios from '@/components/MkRadios.vue';
|
||||
import MkPagination from '@/components/MkPagination.vue';
|
||||
import FormSplit from '@/components/form/split.vue';
|
||||
import * as os from '@/os';
|
||||
import { i18n } from '@/i18n';
|
||||
|
@ -67,19 +74,24 @@ let ads: any[] = $ref([]);
|
|||
const localTime = new Date();
|
||||
const localTimeDiff = localTime.getTimezoneOffset() * 60 * 1000;
|
||||
|
||||
os.api('admin/ad/list').then(adsResponse => {
|
||||
ads = adsResponse.map(r => {
|
||||
const exdate = new Date(r.expiresAt);
|
||||
const stdate = new Date(r.startsAt);
|
||||
exdate.setMilliseconds(exdate.getMilliseconds() - localTimeDiff);
|
||||
stdate.setMilliseconds(stdate.getMilliseconds() - localTimeDiff);
|
||||
return {
|
||||
...r,
|
||||
expiresAt: exdate.toISOString().slice(0, 16),
|
||||
startsAt: stdate.toISOString().slice(0, 16),
|
||||
};
|
||||
});
|
||||
});
|
||||
// os.api('admin/ad/list').then(adsResponse => {
|
||||
// ads = adsResponse.map(r => {
|
||||
// const exdate = new Date(r.expiresAt);
|
||||
// const stdate = new Date(r.startsAt);
|
||||
// exdate.setMilliseconds(exdate.getMilliseconds() - localTimeDiff);
|
||||
// stdate.setMilliseconds(stdate.getMilliseconds() - localTimeDiff);
|
||||
// return {
|
||||
// ...r,
|
||||
// expiresAt: exdate.toISOString().slice(0, 16),
|
||||
// startsAt: stdate.toISOString().slice(0, 16),
|
||||
// };
|
||||
// });
|
||||
// });
|
||||
|
||||
const pagination = {
|
||||
endpoint: 'admin/ad/list' as const,
|
||||
limit: 10,
|
||||
};
|
||||
|
||||
function add() {
|
||||
ads.unshift({
|
||||
|
@ -141,12 +153,11 @@ definePageMetadata({
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.uqshojas {
|
||||
> .ad {
|
||||
>.ad {
|
||||
padding: 32px;
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-bottom: var(--margin);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}</style>
|
||||
|
|
Loading…
Reference in New Issue