mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 09:57:29 -07:00
remove like confirmation
This commit is contained in:
parent
f500fb6a52
commit
114d554747
5 changed files with 30 additions and 36 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "calckey",
|
||||
"version": "12.119.0-calc.19-b16",
|
||||
"version": "12.119.0-calc.19-b17",
|
||||
"codename": "aqua",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</header>
|
||||
<p v-if="page.summary" :title="page.summary">{{ page.summary.length > 85 ? page.summary.slice(0, 85) + '…' : page.summary }}</p>
|
||||
<footer>
|
||||
<img class="icon" :src="page.user.avatarUrl"/>
|
||||
<img class="icon" :src="page.user.avatarUrl" aria-label="none"/>
|
||||
<p>{{ userName(page.user) }}</p>
|
||||
</footer>
|
||||
</article>
|
||||
|
@ -17,7 +17,6 @@
|
|||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { userName } from '@/filters/user';
|
||||
import * as os from '@/os';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
|
|
|
@ -120,12 +120,7 @@ function like() {
|
|||
}
|
||||
|
||||
async function unlike() {
|
||||
const confirm = await os.confirm({
|
||||
type: 'warning',
|
||||
text: i18n.ts.unlikeConfirm,
|
||||
});
|
||||
if (confirm.canceled) return;
|
||||
os.apiWithDialog('gallery/posts/unlike', {
|
||||
os.api('gallery/posts/unlike', {
|
||||
postId: props.postId,
|
||||
}).then(() => {
|
||||
post.isLiked = false;
|
||||
|
|
|
@ -153,12 +153,7 @@ function like() {
|
|||
}
|
||||
|
||||
async function unlike() {
|
||||
const confirm = await os.confirm({
|
||||
type: 'warning',
|
||||
text: i18n.ts.unlikeConfirm,
|
||||
});
|
||||
if (confirm.canceled) return;
|
||||
os.apiWithDialog('pages/unlike', {
|
||||
os.api('pages/unlike', {
|
||||
pageId: page.id,
|
||||
}).then(() => {
|
||||
page.isLiked = false;
|
||||
|
|
|
@ -18,17 +18,19 @@
|
|||
</div>
|
||||
</swiper-slide>
|
||||
<swiper-slide>
|
||||
<div class="rknalgpo my">
|
||||
<MkButton class="new" @click="create()"><i class="ph-plus-bold ph-lg"></i></MkButton>
|
||||
<MkPagination v-slot="{items}" :pagination="myPagesPagination">
|
||||
<MkPagePreview v-for="page in items" :key="page.id" class="ckltabjg" :page="page"/>
|
||||
<div class="rknalgpo liked">
|
||||
<MkPagination v-slot="{items}" :pagination="likedPagesPagination">
|
||||
<MkPagePreview v-for="like in items" :key="like.id" class="ckltabjg" :page="like"/>
|
||||
</MkPagination>
|
||||
</div>
|
||||
</swiper-slide>
|
||||
<swiper-slide>
|
||||
<div class="rknalgpo">
|
||||
<MkPagination v-slot="{items}" :pagination="likedPagesPagination">
|
||||
<MkPagePreview v-for="like in items" :key="like.id" class="ckltabjg" :page="like"/>
|
||||
<div class="rknalgpo my">
|
||||
<div class="buttoncontainer">
|
||||
<MkButton class="new primary" @click="create()"><i class="ph-plus-bold ph-lg"></i> {{ i18n.ts._pages.newPage }}</MkButton>
|
||||
</div>
|
||||
<MkPagination v-slot="{items}" :pagination="myPagesPagination">
|
||||
<MkPagePreview v-for="page in items" :key="page.id" class="ckltabjg" :page="page"/>
|
||||
</MkPagination>
|
||||
</div>
|
||||
</swiper-slide>
|
||||
|
@ -55,21 +57,21 @@ import 'swiper/scss/virtual';
|
|||
const router = useRouter();
|
||||
|
||||
let tab = $ref('featured');
|
||||
const tabs = ['featured', 'my', 'liked'];
|
||||
const tabs = ['featured', 'liked', 'my'];
|
||||
watch($$(tab), () => (syncSlide(tabs.indexOf(tab))));
|
||||
|
||||
const featuredPagesPagination = {
|
||||
endpoint: 'pages/featured' as const,
|
||||
limit: 10,
|
||||
};
|
||||
const myPagesPagination = {
|
||||
endpoint: 'i/pages' as const,
|
||||
limit: 10,
|
||||
};
|
||||
const likedPagesPagination = {
|
||||
endpoint: 'i/page-likes' as const,
|
||||
limit: 10,
|
||||
};
|
||||
const myPagesPagination = {
|
||||
endpoint: 'i/pages' as const,
|
||||
limit: 10,
|
||||
};
|
||||
|
||||
function create() {
|
||||
router.push('/pages/new');
|
||||
|
@ -85,19 +87,19 @@ const headerTabs = $computed(() => [{
|
|||
key: 'featured',
|
||||
title: i18n.ts._pages.featured,
|
||||
icon: 'ph-fire-simple-bold ph-lg',
|
||||
}, {
|
||||
key: 'my',
|
||||
title: i18n.ts._pages.my,
|
||||
icon: 'ph-crown-simple-bold ph-lg',
|
||||
}, {
|
||||
key: 'liked',
|
||||
title: i18n.ts._pages.liked,
|
||||
icon: 'ph-heart-bold ph-lg',
|
||||
}, {
|
||||
key: 'my',
|
||||
title: i18n.ts._pages.my,
|
||||
icon: 'ph-crown-simple-bold ph-lg',
|
||||
}]);
|
||||
|
||||
definePageMetadata(computed(() => ({
|
||||
title: i18n.ts.pages,
|
||||
icon: 'ph-sticker-bold ph-lg',
|
||||
icon: 'ph-file-text-bold ph-lg',
|
||||
})));
|
||||
|
||||
let swiperRef = null;
|
||||
|
@ -114,14 +116,17 @@ function onSlideChange() {
|
|||
function syncSlide(index) {
|
||||
swiperRef.slideTo(index);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
syncSlide(tabs.indexOf(swiperRef.activeIndex));
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.rknalgpo {
|
||||
|
||||
> .buttoncontainer {
|
||||
display: grid;
|
||||
justify-content: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
&.my .ckltabjg:first-child {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue