11<script setup lang="ts">
2+ import type { uni } from ' @delta-comic/model'
3+ import { useQuery } from ' @pinia/colada'
4+ import { createReusableTemplate , useCssVar } from ' @vueuse/core'
5+ import { computed , shallowRef , useTemplateRef } from ' vue'
6+
27import Comment from ' @/components/comment/Comment.vue'
38import ItemCard from ' @/components/ItemCard.vue'
49import { createDateString } from ' @/utils/date'
@@ -14,13 +19,8 @@ defineSlots<{
1419 view(): any
1520}>()
1621
17- const $router = useRouter ()
18- const $route = useRoute ()
1922const $props = defineProps <{ page: uni .content .ContentPage ; isR18g? : boolean }>()
2023
21- const fullscreen = useFullscreen ()
22- const setFullscreen = async (isFull : boolean ) => (isFull ? fullscreen .entry () : fullscreen .exit ())
23-
2424const { data : detail } = useQuery ({
2525 query : ({ signal }) => $props .page .fetchDetail (signal ),
2626 key : () => [LayoutInject .QueryKey .Detail , LayoutInject .createPageQueryKey ($props .page )]
@@ -35,20 +35,6 @@ const safeHeightTop = computed(() => Number(safeHeightTopCss.value?.match(/\d+/)
3535const isScrolled = shallowRef (false )
3636const scrollbar = useTemplateRef (' scrollbar' )
3737
38- const getItemCard = (contentType : uni .content .ContentType_ ) =>
39- uni .item .Item .itemCard .get (contentType ) ?? ItemCard
40-
41- const isLiked = shallowRef (union .value ?.isLiked ?? false )
42- const likeSignal = new SmartAbortController ()
43- const handleLike = async () => {
44- likeSignal .abort ()
45- try {
46- union .value ?.like (likeSignal .signal ).then (v => (isLiked .value = v ))
47- } catch (error ) {
48- console .error (' liked fail' )
49- }
50- }
51-
5238const contentSource = PromiseContent .withResolvers <uni .item .Item >(true )
5339watch (
5440 $props .page .union ,
@@ -74,34 +60,6 @@ $props.page.detail.content.onSuccess(data => {
7460const config = useConfig ()
7561
7662const getActionInfo = (key : string ) => Global .userActions .get ([union .value .$$plugin , key ])!
77-
78- const getIsSubscribe = (author : uni .item .Author ) =>
79- db .value
80- .selectFrom (' subscribe' )
81- .where (' key' , ' =' , ` ${author .$$plugin }:${author .label } ` )
82- .selectAll ()
83- .execute ()
84- .then (v => v .length != 0 )
85-
86- const showDetailUsers = shallowRef (false )
87-
88- const addSubscribe = (author : uni .item .Author ) =>
89- createLoadingMessage (' 关注中' ).bind (
90- SubscribeDB .upsert ({
91- type: ' author' ,
92- author ,
93- plugin: author .$$plugin ,
94- key: SubscribeDB .key .toString ([author .$$plugin , author .label ]),
95- itemKey: null
96- })
97- )
98- const removeSubscribe = (author : uni .item .Author ) =>
99- createLoadingMessage (' 取消中' ).bind (
100- db .value
101- .deleteFrom (' subscribe' )
102- .where (' key' , ' =' , SubscribeDB .key .toString ([author .$$plugin , author .label ]))
103- .execute ()
104- )
10563 </script >
10664
10765<template >
0 commit comments