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