管理画面の広告を10個以上見えるように (#9990)

* 日付のフォーマット指定と変更がうまくいかない

* もっとのボタンで応急処置

* Update packages/frontend/src/pages/admin/ads.vue

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>

* Update packages/frontend/src/pages/admin/ads.vue

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>

* Update packages/frontend/src/pages/admin/ads.vue

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>

* Revert "日付のフォーマット指定と変更がうまくいかない"

This reverts commit c8a81364ef7aac3210723afba66723dacc5a221e.

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
nenohi 2023-02-20 17:57:01 +09:00 committed by GitHub
parent beb9cd5710
commit 543ba2b3b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,9 +44,11 @@
<MkButton class="button" inline danger @click="remove(ad)"><i class="ti ti-trash"></i> {{ i18n.ts.remove }}</MkButton>
</div>
</div>
</div>
<MkButton class="button" @click="more()">
<i class="ti ti-reload"></i>{{ i18n.ts.more }}
</MkButton>
</MkSpacer>
</MkStickyContainer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
@ -123,7 +125,21 @@ function save(ad) {
});
}
}
function more() {
os.api('admin/ad/list', { untilId: ads.reduce((acc, ad) => ad.id != null ? ad : acc).id }).then(adsResponse => {
ads = ads.concat(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 headerActions = $computed(() => [{
asFullButton: true,
icon: 'ti ti-plus',