初始化

This commit is contained in:
谢宇宁
2026-09-15 15:25:05 +07:00
commit 77c16ab4a2
1310 changed files with 132250 additions and 0 deletions
@@ -0,0 +1,411 @@
<template>
<div class="introduction-wrap overflow-y-auto">
<div class="titleBox ellipsis2">
{{ props.info.title }}
</div>
<div class="tags">
<span
class="tag"
@click="goAcgTagPage(item.id, item.name, 'video')"
v-for="item in info.tagDetails || []"
:key="item.id"
>
#{{ item.name }}
</span>
</div>
<div class="videoInfoBox flex-vcenter">
<div class="item margin-r-88">
<span>{{ watchCount(props.info.countBrowse) }} 观看量</span>
</div>
<div class="item" @click="onToogleLiked">
<SvgIcon v-if="props.info.mediaStatus.hasLiked" name="acg-like-1" />
<SvgIcon v-else name="acg-like-0" />
<span>{{ watchCount(props.info.countLike) || '点赞' }}</span>
</div>
<div class="item" @click="onToogleCollected">
<SvgIcon name="acg-collect-star-1" v-if="props.info.mediaStatus.hasCollected" style="color: #f52c56"></SvgIcon>
<SvgIcon name="acg-collect-star-0" v-else></SvgIcon>
<span>{{ watchCount(props.info.countCollect) || '收藏' }}</span>
</div>
<div class="item" @click="openShare">
<SvgIcon name="acg-share" />
<span>分享</span>
</div>
</div>
<div
class="actress-box flex-center-between"
v-if="props.info.actress && props.info.actress.id"
@click="
$router.push({
name: 'AcgActress',
query: {
id: props.info.actress.id,
},
})
"
>
<lazyImg class="portrait" :src="props.info.actress.portrait"></lazyImg>
<div class="info">
<p class="name">{{ props.info.actress.name }}</p>
<div class="count-box flex-vcenter">
<SvgIcon name="acg-video-icon-a-video" />
{{ watchCount(props.info.actress.acgCount) }}部
<SvgIcon name="acg-video-icon-a-collect" style="margin-left: 12px" />
{{ watchCount(props.info.actress.collectCount) }}
</div>
</div>
<SvgIcon class="icon" name="moreIcon" />
</div>
<!-- 选集区域 -->
<div class="episodeArea">
<div class="episodeHeader flex-center-between padding16">
<div class="episodeTitle">选集</div>
<div class="episodeAll flex-vcenter" @click="visibleCatalogue = true">
全{{ props.info.totalEpisode }}话
<SvgIcon class="icon" name="moreIcon" />
</div>
</div>
<div class="episodeBox" @touchstart.stop @touchmove.stop @touchend.stop>
<Episode
class="item"
@click="switchEpisodeNumberCatalogue(item)"
v-for="item in autoList"
:key="item.id"
:info="item"
:episode-number="state.episodeNumber"
></Episode>
</div>
</div>
<HomeHeader :advType="AdType.VIDEOADV" />
<!-- <RecommendList
:media-id="props.info.id"
:contentType="props.info.mediaType"
title="猜你喜欢"
:marginHide="true"
></RecommendList> -->
<RecommendedList :type="info.mediaType" :tagId="info.tagDetails?.[0]?.id" />
<!-- 分享弹窗 -->
<AppSharePopup
:is-open="visibleShare"
@close="visibleShare = false"
coverType="portrait"
:cover="props.info.verticalCover || props.info.horizontalCover"
/>
<Teleport to=".video-detail-wrap">
<van-popup v-model:show="visibleCatalogue" position="bottom" z-index="1001" :style="{ height: '438px' }">
<div class="play-list-box">
<div class="line"></div>
<div class="title flex-center-between">
剧集列表
<!-- <span @click="sort = !sort">
{{ sort ? '正序' : '倒序' }}
</span> -->
</div>
<div class="grading-group" v-if="gradingGroup.length > 1">
<div
class="grading-group-item"
v-for="(item, index) in gradingGroup"
:key="index"
@click.stop="state.gradingGroupIndex = index"
>
{{ item[0].episodeNumber }}-{{ item[item.length - 1].episodeNumber }}
</div>
</div>
<div class="list-box overflow-y-auto">
<PullRefresh :params="moreParams" @onLoad="onLoad" @onRefresh="onRefresh">
<div class="list">
<Episode
class="item"
:episodeNumber="state.episodeNumber"
:info="item"
v-for="item in gradingGroup[state.gradingGroupIndex]"
:key="item.id"
@click="state.episodeNumber = item.episodeNumber"
></Episode>
</div>
</PullRefresh>
</div>
</div>
</van-popup>
</Teleport>
</div>
</template>
<script lang="ts" setup>
import { ref, watch, computed, watchEffect, Ref } from 'vue';
import { HistoryVideoType } from '@/enums/app';
import { goAcgTagPage } from '../../utils/common';
import { watchCount, videoTime } from '@/utils/index';
// import RecommendList from '../../components/recommendList.vue';
import { handleCollected, Collected_emit } from '../../utils/collect';
import { AdType } from '@/enums/app';
import mediaContentInfo from '../../utils/mediaContentInfo';
import CommunityApi from '@/service/community';
import { useGlobalStore } from '@/stores/global';
import Episode from '../../components/episode.vue';
const emits = defineEmits(['updateLiked', 'updateCollected', 'updateItem', 'openRoadLine']);
const globalStore = useGlobalStore();
const props = withDefaults(
defineProps<{
info: Types.Media.MediaInfo;
}>(),
{
info: {},
},
);
const {
state,
currentItem,
autoList,
// switchEpisodeNumberCatalogue,
visibleCatalogue,
sort,
moreParams,
onLoad,
onRefresh,
getList,
buySuccess,
replaceRouter,
} = mediaContentInfo({
isGetInfo: false,
isGetHistoryInit: true,
pageSize: 30,
dbType: HistoryVideoType.AcgVideo,
isScrollTop: false,
});
const gradingGroup = computed(() => {
let arr = autoList.value || [];
if (arr.length > 30) {
const result = [];
for (let i = 0; i < arr.length; i += 30) {
result.push(arr.slice(i, i + 30));
}
return result;
}
return [arr];
});
watch(
() => currentItem.value.id,
() => {
emits('updateItem', currentItem.value);
},
{ immediate: true },
);
defineExpose({
buySuccess,
});
const switchEpisodeNumberCatalogue = (item: Types.Acg.MediaContentListItem) => {
visibleCatalogue.value = false;
state.episodeNumber = item.episodeNumber;
replaceRouter(item.episodeNumber);
};
// 打开分享
const visibleShare = ref(false);
const openShare = () => {
const { id, verticalCover, horizontalCover } = props.info;
let obj = {
id,
cover: verticalCover || horizontalCover,
};
// globalStore.setShareInfo(obj);
visibleShare.value = true;
};
const onToogleCollected = () => {
try {
const {
id,
mediaStatus: { hasCollected },
} = props.info;
const tempIsCollect = !hasCollected;
handleCollected(id, tempIsCollect).then(() => {
emits('updateCollected', tempIsCollect);
Collected_emit(id, tempIsCollect);
});
} catch (e) {
console.log(e);
}
};
const onToogleLiked = () => {
const zan = !props.info.mediaStatus.hasLiked;
(zan ? CommunityApi.zan : CommunityApi.cancleZan)(
zan
? {
type: 'video',
objID: props.info.id,
}
: {
type: 'video',
objIDs: [props.info.id],
},
).then(() => {
emits('updateLiked', zan);
});
};
</script>
<style lang="scss" scoped>
@import '@/assets/styles/mixins.scss';
.introduction-wrap {
height: 100%;
padding: 0 16px;
.titleBox {
font-size: 14px;
font-weight: 500;
line-height: 22px;
margin: 18px 0;
}
.tags {
display: flex;
flex-wrap: wrap;
gap: 8px 10px;
margin: 10px 0 14px;
.tag {
padding: 4px 8px;
border-radius: 3px;
background: rgba(255, 255, 255, 0.05);
color: #fff;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 18px; /* 150% */
}
}
.videoInfoBox {
color: #989898;
font-size: 12px;
margin: 10px 0 18px;
justify-content: space-between;
.item {
display: flex;
align-items: center;
justify-content: center;
svg {
width: 24px;
height: 24px;
margin-right: 2px;
}
}
}
.actress-box {
height: 60px;
margin: 24px 0;
.portrait {
width: 60px;
height: 60px;
flex-shrink: 0;
border-radius: 50%;
overflow: hidden;
margin-right: 12px;
}
.info {
flex: 1;
.name {
color: #fff;
font-size: 14px;
font-style: normal;
font-weight: 500;
line-height: normal;
margin-bottom: 5px;
}
.count-box {
color: rgba(255, 255, 255, 0.6);
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 18px; /* 150% */
svg {
width: 16px;
height: 16px;
margin-right: 4px;
}
}
}
}
.episodeArea {
margin-bottom: 14px;
border-top: 0.5px solid rgba(255, 255, 255, 0.1);
border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
padding-top: 10px;
.episodeHeader {
font-weight: 500;
.episodeTitle {
font-size: 16px;
}
.episodeAll {
color: rgba(255, 255, 255, 0.6);
font-size: 12px;
svg {
width: 18px;
height: 18px;
}
}
}
.episodeBox {
display: flex;
overflow-x: auto;
margin: 12px 0;
.item {
margin-right: 12px;
flex-shrink: 0;
}
}
}
}
.play-list-box {
$paddingBottom: 38px;
width: 100%;
height: 100%;
border-radius: 20px 20px 0px 0px;
background: #0f0f0f;
padding: 18px 16px $paddingBottom;
@include SafeArea('padding', 'bottom', 0);
display: flex;
flex-direction: column;
color: $textColor;
font-size: 12px;
color: rgba(255, 255, 255, 0.9);
> .title {
font-size: 16px;
font-style: normal;
font-weight: 500;
line-height: 25px; /* 140% */
margin: 16px 0;
span {
color: #e0e0e0;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 18px; /* 150% */
}
}
.line {
width: 36px;
height: 5px;
border-radius: 100px;
background: rgba(255, 255, 255, 0.2);
margin: 0 auto;
}
.list-box {
flex: 1;
.list {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
grid-column-gap: 5px;
grid-row-gap: 9px;
}
}
}
.margin-r-88 {
margin-right: 88px;
}
</style>
+468
View File
@@ -0,0 +1,468 @@
<template>
<div ref="rootRef" class="video-detail-wrap">
<SvgIcon name="back_white_round" class="back" @click="$router.go(-1)" />
<template v-if="state.info.id">
<div class="movieBox">
<div class="videoAdv" v-if="state.advsList?.length && state.isShowAdv">
<div class="advVideoBox">
<AdvSwiper :list="state.advsList" :autoplay="2000" v-if="state.advsList.length" class="adv" />
<div class="timer_close" v-if="isVip">
<div v-if="state.timer > 0">
{{ state.timer }}s |
<span @click="state.isShowAdv = false">关闭广告</span>
</div>
<div v-else><span @click="state.isShowAdv = false">关闭</span></div>
</div>
<div class="timer_close" v-else>
<div v-if="state.timer > 0">
{{ state.timer }}s |
<span @click="vipJump">VIP可关闭广告</span>
</div>
<div v-else><span @click="state.isShowAdv = false">关闭</span></div>
</div>
</div>
</div>
<template v-else>
<AnimationHorizontalVideoInfo
:videoInfo="currentItem"
:mediaInfo="state.info"
v-if="currentItem?.videoUrl && showVideo"
:key="currentItem?.episodeNumber"
@buySuccess="beforeBuySuccess"
/>
</template>
</div>
<CountdownBanner
@openMemberPay="showPaymentStatusPopup = true"
/>
<div class="changeLineBox flex-vcenter" :class="!isVip ? 'top258' : ''">
<div class="flex-vcenter" @click.stop="openChangeRoadLine">
<SvgIcon name="changeLineIcon" />
<span>线路切换</span>
</div>
</div>
<van-tabs
v-model:active="tabActive"
:animated="true"
@rendered="onTabRendered"
class="tabs"
:class="{ newUser: !isVip }"
>
<van-tab :title="item.label" v-for="item in itemList" :key="item.value" :name="prefixKey + item.value">
<template v-slot:title>
{{ item.label }}
<Teleport to=".van-tabs__nav">
<span v-if="item.value === 2" class="countComment" :class="{ active: tabActive === prefixKey + 2 }">
{{ watchCount(state.info.countComment) }}
</span>
</Teleport>
</template>
<!--
@selectEpisode="selectEpisode" -->
<Introduction
v-if="tabIsInit(prefixKey + item.value) && item.value == 1 && state.info.id"
ref="introductionRef"
:info="state.info"
@updateCollected="updateCollected"
@updateLiked="updateLiked"
@updateItem="updateItem"
></Introduction>
<CommentBox
v-else-if="tabIsInit(prefixKey + item.value) && item.value == 2 && state.info.id"
:id="prefixKey + item.value"
ref="dvComment"
:isOpen="true"
renderType="normal"
objType="cartoon"
theme="black"
class="comment-comp"
@addComment="state.info.countComment += 1"
:showCollected="false"
></CommentBox>
</van-tab>
</van-tabs>
</template>
<Loading v-else />
</div>
<!-- 切换路线框 -->
<SelectionLinePopup :is-open="showChangeRoadLine" @closeSelectLine="closeSelectLine" @close="closeChangeRoadLine" />
<!-- 开通会员 -->
<PaymentStatusPopup
:show="showPaymentStatusPopup"
:video-id="String(state.info?.id || '')"
@close="closePaymentStatusPopup"
/>
</template>
<script lang="ts">
export default {
name: 'AcgVideoDetail',
};
</script>
<script lang="ts" setup>
import { ref, onUnmounted, nextTick, provide, computed, toRaw, watch, Ref, onMounted, defineAsyncComponent } from 'vue';
import { HistoryVideoType, AdType } from '@/enums/app';
import mediaInfo from '../utils/mediaInfo';
import { useUserStore } from '@/stores/user';
import MineApi from '@/service/mine';
import { watchCount } from '@/utils/index';
// import { Pay_emit } from '../utils/pay-mitt';
import type { PayInfo } from '../utils/pay-mitt';
import Introduction from './components/introduction.vue';
import tabAction from '@/utils/tabAction';
import { useRoute, useRouter } from 'vue-router';
import { getAdItem } from '@/utils/getConfig';
import CountdownBanner from '@/components/CountdownBanner/index.vue';
const PaymentStatusPopup = defineAsyncComponent(() => import('@/components/paymentStatusPopup/index.vue'));
const route = useRoute();
const router = useRouter();
const currentItem = ref({}) as Ref<Types.Acg.MediaContentListItem>;
const itemList = [
{
label: '简介',
value: 1,
},
{
label: '评论',
value: 2,
},
];
const showPaymentStatusPopup = ref(false);
const closePaymentStatusPopup = () => {
showPaymentStatusPopup.value = false;
};
const prefixKey = 'acg_video_';
const { tabActive, tabIsInit, onTabRendered } = tabAction(true);
const { isVip } = useUserStore();
const showVideo = ref(true);
const { state, historyData, addHistory } = mediaInfo({ dbType: HistoryVideoType.AcgVideo });
provide('historyData', historyData);
const showChangeRoadLine = ref(false);
// ------------------- 广告相关逻辑完善 -------------------
const vipJump = () => {
router.push('/member');
};
// 获取广告
const getRandomAdv = () => {
state.advsList = <any>[];
let advs = getAdItem(AdType.NEW_FREE_VIDEO).filter((item: any) => item.watchTime > 0);
if (advs.length > 0) {
state.advsList = advs;
if (!(isVip || historyData.value?.mediaStatus?.hasPaid)) {
state.isShowAdv = true;
return;
}
}
state.isShowAdv = false;
};
// 倒计时
const countdown = () => {
let advs = getAdItem(AdType.NEW_FREE_VIDEO);
if (advs && advs.length) {
state.timer = getAdItem(AdType.NEW_FREE_VIDEO)[0].watchTime;
} else {
state.timer = 0;
}
if (state.countdowner) {
clearInterval(state.countdowner);
}
state.countdowner = setInterval(() => {
state.timer--;
if (state.timer <= 0) {
clearInterval(state.countdowner);
state.countdowner = null;
}
}, 1000);
};
onUnmounted(() => {
state.countdowner && clearInterval(state.countdowner);
});
// 只在动漫数据获取到后再处理广告
watch(
() => currentItem.value,
(val) => {
if (val) {
getRandomAdv();
if (state.advsList.length > 0) {
countdown();
}
}
},
{ immediate: true },
);
const openChangeRoadLine = () => {
showChangeRoadLine.value = true;
};
const closeChangeRoadLine = () => {
showChangeRoadLine.value = false;
};
// 关闭线路选择
const closeSelectLine = () => {
showVideo.value = false;
showChangeRoadLine.value = false;
nextTick(() => {
showVideo.value = true;
});
};
const dvComment = ref();
const initComment = () => {
dvComment.value[0].state.videoInfo = toRaw(state.info);
dvComment.value[0].getCommentList();
};
watch(
dvComment,
(el) => {
if (!el) return;
initComment();
},
{
once: true,
},
);
const updateCollected = (collected: boolean) => {
state.info.mediaStatus.hasCollected = collected;
state.info.countCollect = state.info.countCollect + (collected ? +1 : -1);
};
const updateLiked = (liked: boolean) => {
state.info.mediaStatus.hasLiked = liked;
state.info.countLike = state.info.countLike + (liked ? +1 : -1);
};
const updateItem = (item: any) => {
currentItem.value = item;
if (route.query.tabActive) {
tabActive.value = (prefixKey + route.query.tabActive) as string;
}
};
const introductionRef = ref();
const beforeBuySuccess = (obj: PayInfo) => {
if (obj.type === 'all') {
state.info.mediaStatus.hasPaid = true;
historyData.value.mediaStatus.hasPaid = true;
addHistory(Number(route.query.episodeNumber || 1));
}
introductionRef.value[0].buySuccess(obj.type);
};
</script>
<style lang="scss" scoped>
.video-detail-wrap {
height: 100%;
overflow: hidden;
.back {
width: 24px;
height: 24px;
flex-shrink: 0;
position: fixed;
top: 16px;
left: 16px;
z-index: 800;
}
.movieBox {
width: 375px;
height: 212px;
position: sticky;
top: 0;
left: 0;
//margin-left: -6px;
z-index: 2;
.videoAdv {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 99999;
width: 100%;
height: 212px;
background: rgba(0, 0, 0, 1);
.advVideoBox {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 10;
.timer_close {
font-size: 12px;
position: absolute;
top: 10px;
right: 10px;
z-index: 10;
background: rgba(0, 0, 0, 0.4);
padding: 4px 12px;
border-radius: 40px;
color: white;
// span {
// color: #ff7f0f;
// }
}
.adv {
height: 211px;
width: 375px;
overflow: hidden;
:deep(.van-swipe-item) {
height: 211px !important;
width: 375px !important;
}
}
}
}
}
.newUserBg {
height: 46px;
background: url('@/assets/images/png/newUserBg.png') no-repeat;
background-size: 100% 100%;
font-size: 12px;
font-weight: 500;
padding-left: 98px;
padding-right: 9px;
color: #fff;
&.noNewUser {
// background-image: url('@/assets/images/png/newUserBg2.png');
background-image: url('@/assets/images/png/newUserBg.png');
}
.nowOpenBtn {
color: #000;
background: linear-gradient(270deg, #e3b284 0%, #feeede 100%);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 10px;
display: flex;
align-items: center;
svg {
width: 14px;
height: 14px;
margin-left: 4px;
}
}
}
.changeLineBox {
position: absolute;
top: 212px;
right: 16px;
z-index: 2;
height: 44px;
width: 100px;
justify-content: flex-end;
color: #989898;
font-size: 12px;
font-style: normal;
font-weight: 400;
svg {
width: 16px;
height: 16px;
margin-right: 4px;
}
}
.countComment {
position: absolute;
top: 12px;
left: 112px;
color: rgba(255, 255, 255, 0.45);
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 18px; /* 150% */
&.active {
color: rgba(255, 255, 255, 0.9);
}
}
.tabs {
--van-tab-active-text-color: rgba(255, 255, 255, 0.9);
--van-tab-text-color: rgba(255, 255, 255, 0.45);
height: calc(100% - 269px + 11px);
:deep(> .van-tabs__wrap) {
background-color: unset;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
.van-tabs__nav {
background: unset;
.van-tab {
font-size: 14px;
padding: unset;
width: 60px;
flex: unset;
}
.van-tabs__line {
background-color: $themeColor;
height: 4px;
width: 16px;
border-radius: 2px 2px 0 0;
}
}
}
:deep(> .van-tabs__content) {
height: calc(100% - 44px);
overflow-x: hidden;
.van-tab__panel {
height: 100%;
max-width: 100%;
box-sizing: border-box;
}
}
&.newUser {
height: calc(100% - 269px + 11px);
}
}
.comment-comp {
height: 100%;
:deep(.comment-wrap) {
height: 100%;
.wrapper {
height: 100%;
}
.headerBox {
display: none;
}
.slider {
display: none;
}
.main {
background: transparent;
// border-top: 1px solid #e0e0e0;
height: 100%;
}
.bottomBox {
position: sticky;
left: 0;
bottom: 0;
.commentBtnBox {
.commentInput {
padding-left: 0;
}
}
}
}
}
}
.top258 {
top: 258px !important;
}
:deep(.adv_swiper) {
border-radius: unset !important;
.adv-container {
.adv-swiper-slide {
border-radius: unset !important;
.cover {
border-radius: unset !important;
}
}
}
}
</style>