This commit is contained in:
谢宇宁
2026-10-09 17:39:35 +07:00
parent 406b575139
commit cc37cc173a
21 changed files with 95 additions and 1155 deletions
+2 -1
View File
@@ -2,7 +2,7 @@
<div class="contact">
<div class="title">商务合作</div>
<div class="contact-list">
<div class="item" v-for="(item, index) in state.contactInfo" :key="index" @click="openPage(item.officialUrl)">
<div class="item" v-for="(item, index) in state.contactInfo" :key="index" @click="openPage(OFFICIAL_TG_URL)">
<lazyImg class="connectImg" :src="item.officialImg" />
<div class="text">
<p class="name">{{ item.officialName }}</p>
@@ -15,6 +15,7 @@
<script setup lang="ts">
import { reactive } from 'vue';
import AppApi from '@/service/app';
import { OFFICIAL_TG_URL } from '@/utils/index';
const state = reactive({
contactInfo: <any>[],
});
+2 -1
View File
@@ -2,7 +2,7 @@
<div class="contact">
<div class="title">官方联系</div>
<div class="contact-list">
<div class="item" v-for="(item, index) in contactInfo" :key="index" @click="openPage(item.officialUrl)">
<div class="item" v-for="(item, index) in contactInfo" :key="index" @click="openPage(OFFICIAL_TG_URL)">
<lazyImg class="connectImg" :src="item.officialImg" />
<div class="text">
<p class="name">{{ item.officialName }}</p>
@@ -15,6 +15,7 @@
<script setup lang="ts">
import { computed } from 'vue';
import { useConfigStore } from '@/stores/config';
import { OFFICIAL_TG_URL } from '@/utils/index';
const configStore = useConfigStore();
const contactInfo = computed(() => {
return configStore.contactInfo;
+33 -71
View File
@@ -1,53 +1,20 @@
<template>
<div class="content">
<div class="thematic" v-for="(item, index) in videoList" :key="index">
<div class="title">
{{ item.sectionName }}
<div class="more" @click="toListOfTopics(item)">
<img class="left-arrow" src="@/assets/images/pc/more.png" alt="">
更多
<div class="thematic" v-for="section in advSections" :key="section.position">
<div class="title">{{ section.name }}</div>
<div class="adv-icon-list">
<div class="adv-icon-item" v-for="adv in section.list" :key="adv.id" @click="jumpAdv(adv)">
<DecryptImg class="adv-icon" :src="adv.cover" />
<div class="adv-name">{{ adv.title }}</div>
</div>
</div>
<div class="card-list">
<movieCard :itemData="itemData" v-for="(itemData, i) in item.allVideoInfo" :key="i" />
</div>
<div class="adv-list-wrap" v-if="index % 2 === 1">
<DecryptImg v-for="(item, i) in renderAdvList(index)" class="adv" :src="item.cover" @click="jumpAdv(item)" :key="i"/>
</div>
</div>
</div>
</template>
</template>
<script setup lang="ts">
import { getAdItem } from '@/utils/getConfig';
import { getHomeAdSections } from '@/utils/getConfig';
import { jumpAdv } from '@/utils/index';
import { useRouter } from 'vue-router';
withDefaults(defineProps<{
videoList: Array<any>[]
}>(), {
videoList: () => []
})
const router = useRouter()
const toListOfTopics = (item: any) => {
router.push({
path: '/listOfTopics',
query: {
sectionid: item.sectionID,
name: item.sectionName,
page: 1
}
})
}
const renderAdvList = (index: number) => {
const list = getAdItem(3)
for (let j = 0; j < 10; j++) {
list.push(...list)
}
const i = Math.floor(index / 2 )
const startIndex = i * 2
const endindex = (i + 1) * 2
return list.slice(startIndex, endindex)
}
const advSections = getHomeAdSections();
</script>
<style lang="scss" scoped>
@media (min-width: 768px) {
@@ -65,39 +32,34 @@ const renderAdvList = (index: number) => {
padding-bottom: 28px;
padding-top: 50px;
box-sizing: content-box;
@include flexBetween;
.more {
@include flexBetween;
font-size: 18px;
font-weight: 400;
color: rgba(255, 255, 255, 0.4);
}
.adv-icon-list {
display: grid;
grid-template-columns: repeat(10, 120px);
justify-content: space-between;
row-gap: 32px;
.adv-icon-item {
width: 120px;
cursor: pointer;
img {
width: 24px;
height: 24px;
margin-right: 7px;
.adv-icon {
position: relative;
width: 120px;
height: 120px;
border-radius: 24px;
overflow: hidden;
}
.adv-name {
margin-top: 10px;
color: #fff;
font-size: 18px;
line-height: 24px;
text-align: center;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
.card-list {
display: flex;
flex-wrap: wrap;
column-gap: 24px;
row-gap: 36px;
}
}
.adv-list-wrap {
display: flex;
gap: 24px;
.adv {
margin-top: 30px;
width: 746px;
height: 146px;
border-radius: 8px;
overflow: hidden;
}
}
}
}
+2 -38
View File
@@ -1,42 +1,6 @@
<template>
<!-- 轮播 -->
<banner :swiperList="swiperList" :bannerList="bannerList" />
<content :videoList="videoList" v-if="videoList.length > 0" />
<content />
</template>
<script setup lang="ts" name="home">
import { ref, watchEffect } from 'vue'
import { useHomeStore } from '@/stores/home'
import banner from './banner.vue';
import content from './content.vue';
import HomeApi from '@/service/home';
const homeStore = useHomeStore()
const swiperList = ref([])
const videoList = ref([])
watchEffect(async() => {
const homeData = homeStore.homeData.find(item => item.showType === 1) || {}
if (homeData.id) {
const res: any = await HomeApi.getModuleList({
id: homeData.id,
data: {
pageNumber: 1,
pageSize: 10,
videoCount: 16,
moduleSort: homeData.moduleSort
}
})
getBannerList()
const allSection = res.allSection
swiperList.value = (allSection.find((item: any) => item.showType === 2) || {}).allVideoInfo || []
videoList.value = allSection.filter((item: any) => item.showType !== 2) || []
}
})
const bannerList = ref([])
const getBannerList = async () => {
const res: any = await HomeApi.getRangking({
pageNumber: 1,
pageSize: 10,
})
bannerList.value = res.videos
}
</script>
</script>
+2 -310
View File
@@ -1,58 +1,15 @@
<template>
<div id="home">
<div class="header-wrap-box">
<div class="adv-wrap" v-if="showHeaderAdv && getAdItem(1).length > 0">
<swiper loop :autoplay="{ delay: 5000, disableOnInteraction: false, pauseOnMouseEnter: true, }" :modules="[Autoplay]">
<swiper-slide class="adv" v-for="(item, index) in getAdItem(1)" :key="index" @click="jumpAdv(item)">
<DecryptImg class="banner-img" :src="item.cover" />
</swiper-slide>
</swiper>
<img @click="closeHeaderAdv" class="close-adv" src="@/assets/images/pc/adv_close.png" />
</div>
<div class="header-wrap">
<div class="flex-vcenter left-wrap">
<img @click="jumpPage('/home')" class="logo" src="@/assets/images/pc/logo.png" />
<div class="tab-list">
<span
class="item"
:class="{ active: activeIndex === index }"
@click="changeTab(item, index)"
v-for="(item, index) in homeStore.homeData"
:key="index">
{{ item.subModuleName }}
<span v-show="activeIndex === index">✨</span>
</span>
</div>
</div>
<div class="right-list">
<div class="search-box">
<input type="text" v-model="searchText" @keydown.enter="tosearch" placeholder="输入你搜索的关键字">
<div class="search-btn" @click="tosearch">
<img class="search" src="@/assets/images/pc/search.png" />
</div>
</div>
<div class="item history-box">
<div @click="toHistory" @mouseover="getHistoryList">
<img class="search" src="@/assets/images/pc/history.png" />
<p>观看历史</p>
</div>
<div class="history-list-box-wrap" v-if="historyList.length > 0">
<div class="history-list-box">
<img class="top-tip" src="@/assets/images/pc/history_bg.png" />
<div class="movie-list" @click="toMoivePlay(item.id)" v-for="(item, index) in historyList" :key="index">
<DecryptImg class="cover" :src="item.cover" :key="item.cover + Math.random()" />
<div class="described ellipsis2">{{ item.title }}</div>
</div>
<div class="more-btn" @click="toHistory">更多 <img src="@/assets/images/pc/left_arrow.png" alt=""></div>
</div>
</div>
</div>
<div class="item" @click="jumpPage('/business')">
<img class="search" src="@/assets/images/pc/business.png" />
<p>商务合作</p>
</div>
<DecryptImg @click="userHandle" class="avatar" v-if="userInfo?.portrait" :src="userInfo.portrait" :key="userInfo?.portrait" />
<img v-else @click="userHandle" class="avatar" src="@/assets/images/pc/avatar.png" />
<div class="official" @click="jumpPage('/contact')">联系官方</div>
</div>
</div>
@@ -66,33 +23,14 @@
</div>
</template>
<script setup lang="ts">
import { ref, watchEffect, computed, watch, onMounted } from 'vue'
import { jumpAdv } from '@/utils/index';
import { computed } from 'vue'
import { getAdItem } from '@/utils/getConfig'
import { Autoplay } from 'swiper'
import { Swiper, SwiperSlide } from 'swiper/vue'
import 'swiper/swiper.min.css';
import { useHomeStore } from '@/stores/home'
import { HistoryVideoType } from '@/enums/app';
import { queryHistoryVideo } from '@/utils';
import Mask from './mask.vue';
import { useRouter, useRoute } from 'vue-router';
import { useRouter } from 'vue-router';
import { useGlobalStore } from '@/stores/global';
import { eventBus } from "@/utils/eventBus";
const globalStore = useGlobalStore();
const router = useRouter();
const route = useRoute()
const homeStore = useHomeStore()
const userInfo = computed(() => {
const data = localStorage.getItem('userInfo') || '{}'
if (data) {
return JSON.parse(data)
}
return data
})
const searchText = ref('')
const activeIndex = ref(0)
// const isShowAdvPopup = ref(false)
@@ -106,102 +44,10 @@ const isShowAdvPopup = computed(() => {
const closeHomePopupAdv = () => {
globalStore.setHomeAdvFirst();
};
watchEffect(() => {
if (['/home','/welfare', '/classification', '/pageList'].includes(route.path)) {
activeIndex.value = Number(route.query.index || 0)
} else {
activeIndex.value = -1
}
})
watch(() => route.path, (path) => {
if (path !== '/search') {
searchText.value = ''
}
})
const changeTab = (item: any, index: number) => {
activeIndex.value = index
if (item.showType === 2) {
router.push({
path: '/pageList',
query: {
index,
id: item.id,
name: item.subModuleName,
page: 1
}
})
}
if (item.showType === 1) {
router.push({
path: '/home',
query: {
index,
id: item.id,
}
})
}
if (item.showType === 4) {
router.push('/welfare?index=' + index)
}
if (item.showType === 5) {
router.push('/classification?index=' + index)
}
}
const tosearch = () => {
router.push({
path: '/search',
query: {
id: searchText.value,
page: 1
}
})
}
const jumpPage = (path: string) => {
router.push(path)
}
const showHeaderAdv = ref(true)
showHeaderAdv.value = !sessionStorage.getItem('HeaderAdv')
const closeHeaderAdv = () => {
sessionStorage.setItem('HeaderAdv', 'true')
showHeaderAdv.value = false
}
const userHandle = () => {
if (userInfo.value.account) {
router.push('/mine')
} else {
eventBus.emit('SHOW_LOGIN')
}
}
const historyList = ref([])
const getHistoryList = async () => {
const list: any = await queryHistoryVideo(1, 3, HistoryVideoType.VIDEO)
historyList.value = list
};
const toMoivePlay = (id: string) => {
router.push({
path: '/moviePlay',
query: {
vid: id,
page: 1
}
})
}
getHistoryList()
const toHistory = () => {
if (userInfo.value.account) {
router.push('/mine/history')
} else {
eventBus.emit('SHOW_LOGIN')
}
}
</script>
<style lang="scss" scoped>
@media (min-width: 768px) {
@@ -215,29 +61,6 @@ const toHistory = () => {
position: sticky;
top: 0;
z-index: 100;
.adv-wrap {
border: 1px solid #34363B;
background: #1A1C22;
width: 100%;
height: 100px;
position: relative;
.adv {
height: 100%;
width: max-content;
}
.banner-img {
width: 100%;
height: 100px;
}
.close-adv {
width: 50px;
height: 20px;
position: absolute;
top: 20px;
right: 200px;
z-index: 1;
}
}
}
.header-wrap {
width: 100%;
@@ -256,55 +79,6 @@ const toHistory = () => {
.logo:hover {
transform: scale(1.02);
}
.tab-list {
display: flex;
align-items: center;
color: #A3A4A7;
font-size: 16px;
font-weight: 400;
.item {
padding: 14px;
cursor: pointer;
white-space: nowrap;
}
.active {
color: #FFF;
font-size: 18px;
}
.item:hover {
color: #FFF;
}
}
.search-box {
width: 240px;
height: 36px;
padding: 10px 0 10px 12px;
box-sizing: border-box;
border-radius: 4px;
background: rgba(255, 255, 255, 0.20);
display: flex;
align-items: center;
input {
all: unset;
color: #fff;
flex: 1;
}
.search-btn {
cursor: pointer;
}
.search {
width: 24px;
height: 24px;
margin: 0 11px;
}
}
.right-list {
display: flex;
align-items: center;
@@ -326,19 +100,6 @@ const toHistory = () => {
color: #fff;
}
.avatar {
width: 38px;
height: 38px;
border-radius: 50%;
overflow: hidden;
margin: 30px;
cursor: pointer;
transition: all 0.2s;
}
.avatar:hover {
transform: scale(1.1);
transition: all 0.2s;
}
.official {
width: 87px;
height: 36px;
@@ -356,75 +117,6 @@ const toHistory = () => {
}
}
.history-box {
position: relative;
.history-list-box-wrap {
width: 282px;
min-height: 100px;
position: absolute;
top: 45px;
transform: translateX(-50%);
left: 50%;
display: none;
}
.history-list-box {
width: 282px;
padding: 16px;
position: absolute;
left: 50%;
top: 60px;
transform: translateX(-50%);
border-radius: 4px;
border: 1px solid rgba(255, 255, 255, 0.25);
background: #1A1C22;
.top-tip {
position: absolute;
top: -18px;
left: 50%;
transform: translateX(-50%);
width: 12px;
height: 12px;
}
.movie-list {
display: flex;
align-items: center;
margin-bottom: 16px;
}
.cover {
width: 110px;
height: 62px;
border-radius: 4px;
overflow: hidden;
margin-right: 8px;
}
.described {
width: 130px;
height: 44px;
text-align: left;
color: #A9A9AC;
font-size: 14px;
font-weight: 400;
line-height: 22px;
border-bottom: 2px solid rgba(255, 255, 255, 0.12);
}
.more-btn {
@include flexCenter;
height: 44px;
color: #A9A9AC;
font-size: 14px;
font-weight: 400;
img {
width: 16px;
height: 16px;
}
}
}
}
.history-box:hover {
.history-list-box-wrap {
display: block;
}
}
:deep() {
.imgBox {
width: 474px !important;