初始化黄果短剧 H5 客户端

对接后端 hgmjapi.mfcg.me:
- 接口解密 key 更新为 resKey360
- 登录 sysType 使用原生 getDevType(后端已放开 pc/android)
- 修正榜单接口路径 /vid/rangking → /vid/ranking,方法改为 GET

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
谢宇宁
2026-10-08 19:41:43 +07:00
co-authored by Claude Opus 4.8
commit c957b45bad
633 changed files with 51497 additions and 0 deletions
@@ -0,0 +1,158 @@
<template>
<div class="classification">
<div class="topicBox" v-for="i in state.topicList" :key="i.id">
<div class="topicTitle">{{ i.subModuleName }}</div>
<div class="tagList">
<div class="tagItem" v-for="item in i.allSection" :key="item.id" @click="jumpTopice(item)">
{{ item.name }}
<span>({{ item.videoCount }})</span>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { reactive, computed } from 'vue';
import { useGlobalStore } from '@/stores/global';
import { useRoute, useRouter } from 'vue-router';
import HomeApi from '@/service/home';
const route = useRoute();
const router = useRouter();
const globalStore = useGlobalStore();
const state = reactive({
topicList: <any>[],
topicName: route.query.name,
});
const jumpTopice = (item: any) => {
let queryData = {
tid: item.id,
name: item.name,
};
router
.push({
path: '/sectionDetails',
query: queryData,
})
// .then(() => {
// location.reload();
// });
};
const getTagList = async () => {
const res: any = await HomeApi.getTabs({ isSection: true });
state.topicList = res.homePage || [];
};
const init = () => {
getTagList();
};
init();
</script>
<style scoped lang="scss">
.classification {
padding: 18px 16px 0;
box-sizing: border-box;
.advBanner {
width: 100%;
height: 70px;
}
.topicBox {
margin-bottom: 24px;
.topicTitle {
color: #fff;
font-family: 'PingFang SC';
font-size: 18px;
font-style: normal;
font-weight: 500;
line-height: 28px; /* 155.556% */
margin-bottom: 12.25px;
}
.tagList {
display: flex;
flex-wrap: wrap;
align-items: center;
.tagItem {
padding: 4px 12px;
box-sizing: border-box;
color: #fff;
font-family: 'PingFang SC';
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 20px; /* 142.857% */
border-radius: 8px;
border: 1px solid #212121;
background: #151515;
margin: 0 8px 8px 0;
span {
color: #a0a6b4;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 16px;
}
}
}
}
.topicBox:last-child {
margin-bottom: 60px;
}
.dropdownBox {
width: 76px;
height: 33px;
border-radius: 6.986px;
border: 0.873px solid #212121;
background: #151515;
margin-bottom: 13.6px;
// background: skyblue;
:deep(.van-dropdown-menu__bar) {
background: rgba(0, 0, 0, 0);
height: 100%;
}
:deep(.van-dropdown-menu__title) {
padding: 0;
padding-right: 6px;
}
:deep(.van-dropdown-menu__title--active:after) {
border-color: transparent transparent #a0a6b4 #a0a6b4;
}
:deep(.van-ellipsis) {
color: #a0a6b4;
font-size: 12px;
}
:deep(.van-dropdown-item) {
width: 76px;
right: 16px;
left: auto;
// right: 16px !important;
// top: 69px !important;
.van-dropdown-item__content {
border-radius: 5.548px;
border: 0.693px solid #212121;
background: #151515 !important;
padding: 7px 0;
box-sizing: border-box;
.van-dropdown-item__option {
background: #151515 !important;
padding: 0 13.87px;
// height: 20px;
}
.van-cell__title {
color: #a0a6b4;
font-size: 9.709px;
}
}
.van-cell:after {
display: none !important;
}
.van-cell__value {
display: none;
}
}
}
}
</style>
+192
View File
@@ -0,0 +1,192 @@
<template>
<div class="homeItem">
<van-notice-bar
class="homeNotice"
scrollable
background="#2B2C2E"
color="#FFF"
:speed="60"
v-if="state.announceText && state.announceText.length"
>
<span v-for="(item, index) in state.announceText" :key="index">{{ item }}</span>
</van-notice-bar>
<BannerSwiper :list="state.bannerList" class="bannerSwiper" v-if="state.bannerList && state.bannerList.length" />
<MobileSwiper :list="state.rankList" v-if="state.rankList && state.rankList.length" class="rankSwiper" />
<div class="topicBox" v-for="(item, index) in state.topicsList" :key="item.sectionID">
<div class="topicTitleBox">
<div class="topicTitle">{{ item.sectionName }}</div>
<div class="moreBtn" @click="jumpTopic(item)">
<SvgIcon name="moreIcon" class="moreIcon" />
<span>更多</span>
</div>
</div>
<div class="videoList">
<MobileVideoBox :videoInfo="i" v-for="i in item.allVideoInfo" :key="i.id" />
</div>
<AdvBanner
class="advBanner"
:advInfo="state.advList[index % state.advList.length]"
:key="state.advList[index % state.advList.length]"
v-if="state.advList.length"
/>
<!-- <AdvBanner class="advBanner" :advInfo="i" v-for="i in state.advList" :key="i.id" /> -->
</div>
</div>
</template>
<script lang="ts" setup>
import { reactive, computed } from 'vue';
import { useGlobalStore } from '@/stores/global';
import { AdType } from '@/enums/app';
import { getAdItem } from '@/utils/getConfig';
import { useRoute, useRouter } from 'vue-router';
import HomeApi from '@/service/home';
const route = useRoute();
const router = useRouter();
const props = defineProps({
tid: {
type: String,
required: true,
},
});
const globalStore = useGlobalStore();
const state = reactive({
bannerList: [],
announceText: '',
topicsList: <any>[],
rankList: <any>[],
advList: <any>[],
});
const queryList = async () => {
let req = {
id: props.tid,
data: {
pageNumber: 1,
pageSize: 10,
videoCount: 8,
},
};
let res: any = await HomeApi.getModuleList(req);
let allSection = res.allSection || [];
allSection.forEach((item: any) => {
if (item.showType == 2) {
state.bannerList = state.bannerList.concat(item.allVideoInfo || []);
} else {
state.topicsList = state.topicsList.concat(item || []);
}
// console.log(state.topicsList, '-=-==-');
});
};
const queryRanks = async () => {
let req = {
pageNumber: 1,
pageSize: 20,
};
let res: any = await HomeApi.getRangking(req);
state.rankList = res.videos || [];
console.log(state.rankList);
};
const getAnnounce = async () => {
let res: any = await HomeApi.getAnnounce();
state.announceText = res.announcement || [];
};
const jumpTopic = (item: any) => {
const queryData = {
tid: item.sectionID,
name: item.sectionName,
};
router.push({ path: '/sectionDetails', query: queryData }).then(() => {
// location.reload();
});
};
const init = () => {
state.advList = getAdItem(AdType.MOBILEHOMETOPIC);
queryList();
queryRanks();
getAnnounce();
};
init();
</script>
<style scoped lang="scss">
.homeItem {
background: #000;
.homeNotice {
height: 31px;
padding: 0;
span {
margin-right: 60px;
}
}
.bannerSwiper {
height: 162px;
margin-bottom: 15px;
}
.rankSwiper {
margin-bottom: 24.36px;
}
.videoSwiper {
margin-bottom: 24.36px;
}
.topicBox {
padding: 0 16px;
box-sizing: border-box;
margin-bottom: 24px;
.topicTitleBox {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
.topicTitle {
font-size: 16px;
font-style: normal;
font-weight: 600;
line-height: 18px; /* 112.5% */
letter-spacing: 0.5px;
}
.moreBtn {
display: flex;
align-items: center;
justify-content: center;
.moreIcon {
margin-right: 3.43px;
width: 16px;
height: 16px;
}
span {
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 13.714px;
color: rgba(255, 255, 255, 0.4);
}
}
}
.videoList {
display: grid;
grid-template-columns: 1fr 1fr;
grid-row-gap: 16px;
grid-column-gap: 12px;
}
.advBanner {
margin-top: 24px;
border-radius: 8px;
overflow: hidden;
height: 67px;
:deep(img) {
border-radius: 8px;
}
}
}
.topicBox:last-child {
margin-bottom: 29px;
}
}
.showAdvBanner {
height: calc(100vh - 160px);
}
</style>
@@ -0,0 +1,318 @@
<template>
<div class="topicDetails">
<div class="optBox">
<div class="subTitle">{{ state.topicName }}</div>
<van-dropdown-menu ref="menuRef" class="dropdownBox" :overlay="false">
<van-dropdown-item v-model="state.moduleSort" :options="state.options" @change="changeOpt" />
</van-dropdown-menu>
</div>
<div class="videoList">
<div class="videoItem" v-for="item in state.list" :key="item.id">
<AdvBox :advInfo="item" v-if="item.isAdv" />
<MobileVideoBox :videoInfo="item" v-else />
</div>
</div>
<MobilePagination
class="pagination"
:pageNumber="state.pageNumber"
:pageSize="state.pageSize"
:total="state.total"
@changePage="changePage"
v-if="state.total > state.pageSize"
/>
<div class="topicBox" v-for="i in state.topicList" :key="i.id">
<div class="topicTitle">{{ i.subModuleName }}</div>
<div class="tagList">
<div class="tagItem" v-for="item in i.allSection" :key="item.id" @click="jumpTopice(item)">
{{ item.name }}
<span>({{ item.videoCount }})</span>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { reactive, computed } from 'vue';
import { useGlobalStore } from '@/stores/global';
import { useRoute, useRouter } from 'vue-router';
import { getAdItem } from '@/utils/getConfig';
import { AdType } from '@/enums/app';
import insertAdv from '@/utils/insertAdv'
import HomeApi from '@/service/home';
const route = useRoute();
const router = useRouter();
const globalStore = useGlobalStore();
const state = reactive({
options: [
{ text: '默认', value: 1 },
{ text: '最新上架', value: 2 },
{ text: '最多观看', value: 3 },
{ text: '最多收藏', value: 4 },
],
pageNumber: <any>1,
pageSize: 7,
moduleSort: route.query.sort || 1,
list: <any>[],
advList: <any>[],
topicList: <any>[],
total: 0,
topicName: route.query.name,
});
const queryList = async () => {
let req = {
id: route.query.tid,
data: {
pageNumber: state.pageNumber,
pageSize: state.pageSize,
moduleSort: state.moduleSort,
},
};
let res: any = await HomeApi.getModuleList(req);
// const updatedArray = insertAdv({
// insertNum: 6,
// pageSize,
// pageNumber: pageNumber,
// originArray: res.videos,
// advNum: 5
// })
let videoList = res.allVideoInfo || [];
let params = {
insertNum: 6,
pageSize: state.pageSize,
pageNumber: state.pageNumber,
advNum: 6,
originArray: videoList,
};
state.list = insertAdv(params);
// console.log(newarr);
// videoList.forEach((i,j) => {
// let index = state.pageSize * (state.pageNumber - 1) + j;
// })
// state.list = res.allVideoInfo || [];
state.total = res.total || 0;
// console.log(state.list);
// allSection.forEach((item: any) => {
// // if (item.showType == 2) {
// // state.bannerList = state.bannerList.concat(item.allVideoInfo || []);
// // } else {
// // state.topicsList = state.topicsList.concat(item || []);
// // }
// // // console.log(state.topicsList, '-=-==-');
// });
};
const changePage = (pageNumber: any) => {
let queryData = {
tid: route.query.tid,
stype: route.query.stype,
pageNumber: pageNumber,
sort: route.query.sort,
name: route.query.name,
};
router
.push({
path: '/home',
query: queryData,
})
.then(() => {
location.reload();
});
};
const changeOpt = (val: any) => {
let queryData = {
tid: route.query.tid,
stype: route.query.stype,
name: route.query.name,
pageNumber: 1,
sort: val,
};
router.replace({
path: '/home',
query: queryData,
});
// .then(() => {
// // location.reload();
// });
queryList();
};
const jumpTopice = (item: any) => {
let queryData = {
tid: item.id,
name: item.name,
};
router.push({
path: '/sectionDetails',
query: queryData,
});
// .then(() => {
// location.reload();
// });
};
const getTagList = async () => {
const res: any = await HomeApi.getTabs({ isSection: true });
state.topicList = res.homePage || [];
};
const init = () => {
state.advList = getAdItem(AdType.HOMETOPBANNER);
state.pageNumber = Number(route.query.pageNumber) || 1;
state.moduleSort = Number(route.query.sort) || 1;
queryList();
getTagList();
};
init();
</script>
<style scoped lang="scss">
.topicDetails {
padding: 18px 16px 0;
box-sizing: border-box;
// padding-top: 27px;
// box-sizing: border-box;
.advBanner {
width: 100%;
height: 70px;
}
.optBox {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 24px;
}
.subTitle {
color: #fff;
font-family: 'PingFang SC';
font-size: 18px;
font-style: normal;
font-weight: 600;
line-height: 16px; /* 88.889% */
letter-spacing: 0.5px;
margin-bottom: 8px;
}
.videoNum {
color: #fff;
font-family: Inter;
font-size: 13px;
font-style: normal;
font-weight: 400;
line-height: 20px; /* 153.846% */
margin-bottom: 16px;
span {
color: #a0a6b4;
font-size: 12px;
}
}
.videoList {
display: grid;
grid-template-columns: 1fr 1fr;
grid-row-gap: 28px;
grid-column-gap: 12px;
margin-bottom: 28px;
}
.pagination {
margin-bottom: 24px;
}
.topicBox {
margin-bottom: 24px;
.topicTitle {
color: #fff;
font-family: 'PingFang SC';
font-size: 18px;
font-style: normal;
font-weight: 500;
line-height: 28px; /* 155.556% */
margin-bottom: 12.25px;
}
.tagList {
display: flex;
flex-wrap: wrap;
align-items: center;
.tagItem {
padding: 4px 12px;
box-sizing: border-box;
color: #fff;
font-family: 'PingFang SC';
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 20px; /* 142.857% */
border-radius: 8px;
border: 1px solid #212121;
background: #151515;
margin: 0 8px 8px 0;
span {
color: #a0a6b4;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 16px;
}
}
}
}
.topicBox:last-child {
margin-bottom: 60px;
}
.dropdownBox {
width: 76px;
height: 33px;
border-radius: 6.986px;
border: 0.873px solid #212121;
background: #151515;
margin-bottom: 13.6px;
// background: skyblue;
:deep(.van-dropdown-menu__bar) {
background: rgba(0, 0, 0, 0);
height: 100%;
}
:deep(.van-dropdown-menu__title) {
padding: 0;
padding-right: 6px;
}
:deep(.van-dropdown-menu__title--active:after) {
border-color: transparent transparent #a0a6b4 #a0a6b4;
}
:deep(.van-ellipsis) {
color: #a0a6b4;
font-size: 12px;
}
:deep(.van-dropdown-item) {
width: 76px;
right: 16px;
left: auto;
// right: 16px !important;
// top: 69px !important;
.van-dropdown-item__content {
border-radius: 5.548px;
border: 0.693px solid #212121;
background: #151515 !important;
padding: 7px 0;
box-sizing: border-box;
.van-dropdown-item__option {
background: #151515 !important;
padding: 0 13.87px;
// height: 20px;
}
.van-cell__title {
color: #a0a6b4;
font-size: 9.709px;
}
}
.van-cell:after {
display: none !important;
}
.van-cell__value {
display: none;
}
}
}
}
</style>
+300
View File
@@ -0,0 +1,300 @@
<template>
<div class="welfare">
<div class="box1">
<div class="img-list">
<div class="item-list">
<DecryptImg
v-for="(item, index) in state.smallSuure.slice(0, 3)"
class="cover"
@click="jumpAdv(item, true)"
:src="item.icon"
:key="item.icon + index"
/>
</div>
<div class="item-list">
<DecryptImg
v-for="(item, index) in state.smallSuure.slice(3, 6)"
class="cover"
@click="jumpAdv(item, true)"
:src="item.icon"
:key="item.icon + index"
/>
</div>
<div class="item-list">
<DecryptImg
v-for="(item, index) in state.smallSuure.slice(6, 10)"
class="cover"
@click="jumpAdv(item, true)"
:src="item.icon"
:key="item.icon + index"
/>
</div>
<div class="item-list">
<DecryptImg
v-for="(item, index) in state.smallSuure.slice(10, 13)"
class="cover"
@click="jumpAdv(item, true)"
:src="item.icon"
:key="item.icon + index"
/>
</div>
<div class="item-list">
<DecryptImg
v-for="(item, index) in state.smallSuure.slice(13, 17)"
class="cover"
@click="jumpAdv(item, true)"
:src="item.icon"
:key="item.icon + index"
/>
</div>
<div class="item-list">
<DecryptImg
v-for="(item, index) in state.smallSuure.slice(17, 20)"
class="cover"
@click="jumpAdv(item, true)"
:src="item.icon"
:key="item.icon + index"
/>
</div>
<div class="item-list">
<DecryptImg
v-for="(item, index) in state.smallSuure.slice(20, 23)"
class="cover"
@click="jumpAdv(item, true)"
:src="item.icon"
:key="item.icon + index"
/>
</div>
</div>
<div class="img-list-one">
<DecryptImg
v-for="(item, index) in state.smallSuure.slice(23, 24)"
class="cover"
@click="jumpAdv(item, true)"
:src="item.icon"
:key="item.icon + index"
/>
</div>
<div class="title">
<p>在線視頻</p>
<p>来自一站式你所熟悉的蛋黄派</p>
</div>
</div>
<div class="box2">
<div class="subTitle">
<p v-for="(item, index) in state.bgImage1" :key="index">{{ item }}</p>
</div>
<swiper
ref="gameSwiper"
slides-per-view="auto"
:observer="true"
:navigation="true"
:space-between="6"
:slidesOffsetBefore="0"
class="gameSwiper"
>
<swiper-slide v-for="i in state.verticalSlide" :key="i.id" class="gameSwiperItem" @click="jumpAdv(i, true)">
<DecryptImg :src="i.icon" class="gameSwiperImg" :key="i.id" />
</swiper-slide>
</swiper>
</div>
<div class="box3">
<div class="subTitle">
<p v-for="(item, index) in state.bgImage2" :key="index">{{ item }}</p>
</div>
<swiper
ref="topGameSwiper"
slides-per-view="auto"
:observer="true"
:navigation="true"
:space-between="6"
:slidesOffsetBefore="-20"
class="topGameSwiper"
>
<swiper-slide
v-for="i in state.verticalTwoSlide"
:key="i.id"
class="topGameSwiperItem"
@click="jumpAdv(i, true)"
>
<DecryptImg :src="i.icon" class="topGameSwiperImg" :key="i.id" />
</swiper-slide>
</swiper>
<swiper
ref="topGameSwiper"
slides-per-view="auto"
:observer="true"
:navigation="true"
:space-between="6"
:slidesOffsetBefore="14"
class="topGameSwiper"
>
<swiper-slide
v-for="i in state.smallSqureSlide"
:key="i.id"
class="topGameSwiperItem"
@click="jumpAdv(i, true)"
>
<DecryptImg :src="i.icon" class="topGameSwiperImg" :key="i.id" />
</swiper-slide>
</swiper>
</div>
</div>
</template>
<script lang="ts"></script>
<script lang="ts" setup>
import { reactive, nextTick } from 'vue';
import { useGlobalStore } from '@/stores/global';
import { jumpAdv } from '@/utils/index';
import { Swiper, SwiperSlide } from 'swiper/vue';
import { Autoplay, Pagination, FreeMode } from 'swiper';
import request from '@/utils/request';
import 'swiper/swiper.min.css';
import AppApi from '@/service/app';
const globalStore = useGlobalStore();
const state = reactive({
smallSuure: <any>[],
verticalSlide: <any>[],
bgImage1: <any>[],
verticalTwoSlide: <any>[],
bgImage2: <any>[],
smallSqureSlide: <any>[],
isScroll: true,
});
const queryConfig = async () => {
try {
let res = await AppApi.queryWelfare();
const resdata = res.list || []
const data = resdata.find((item: any) => item.desc === '福利模块') || {};
const dataList = data.comboList || [];
state.smallSuure = dataList.find((item: any) => item.displayType === 'smallSuure').list;
state.verticalSlide = dataList.find((item: any) => item.displayType === 'verticalSlide').list;
// #换行
state.bgImage1 = dataList.find((item: any) => item.displayType === 'bgImage1').list[0]?.desc?.split('#') || [];
state.verticalTwoSlide = dataList.find((item: any) => item.displayType === 'verticalTwoSlide').list;
// #换行
state.bgImage2 = dataList.find((item: any) => item.displayType === 'bgImage2').list[0]?.desc?.split('#') || [];
state.smallSqureSlide = dataList.find((item: any) => item.displayType === 'smallSqureSlide').list;
} catch (error) {
console.log();
}
};
nextTick(() => {
queryConfig();
});
</script>
<style scoped lang="scss">
.welfare {
.box1 {
width: 100%;
height: 425px;
background: #fff;
.img-list {
display: flex;
// align-items: center;
justify-content: space-between;
.item-list:nth-child(2n) {
padding-top: 18px !important;
}
.cover {
width: 46px;
height: 46px;
margin-bottom: 8.4px;
}
}
.img-list-one {
width: 63.4px;
height: 63.4px;
margin: 0 auto 52.11px;
}
.title {
color: #000;
text-align: center;
font-family: Roboto;
font-size: 22px;
font-style: normal;
font-weight: 900;
line-height: 30px; /* 77.921% */
}
}
.box2 {
height: 348px;
background: url('../../../assets/images/pc/game_bg.png') no-repeat;
background-size: 100% 100%;
background-color: #000;
padding-top: 79px;
.subTitle {
color: #fff;
font-size: 22px;
font-weight: 900;
line-height: 18.333px; /* 83.333% */
margin-bottom: 57.45px;
p {
text-align: center;
margin-bottom: 11.55px;
}
p:last-child {
margin-bottom: 0;
}
}
.gameSwiper {
.gameSwiperItem {
width: 112px;
height: 138px;
.gameSwiperImg {
width: 112px;
height: 138px;
border-radius: 4.67px;
overflow: hidden;
:deep(img) {
border-radius: 4.67px;
}
}
}
}
}
.box3 {
background-color: #fff;
padding-top: 59px;
box-sizing: border-box;
.subTitle {
color: #000;
font-size: 22px;
font-weight: 900;
line-height: 18.333px; /* 83.333% */
padding-bottom: 49px;
p {
text-align: center;
margin-bottom: 11.55px;
}
p:last-child {
margin-bottom: 0;
}
}
.topGameSwiper {
margin-bottom: 17.4px;
.topGameSwiperItem {
width: 112px;
height: 138px;
.topGameSwiperImg {
width: 112px;
height: 138px;
border-radius: 4.67px;
overflow: hidden;
:deep(img) {
border-radius: 4.67px;
}
}
}
}
.topGameSwiper:last-child {
margin-bottom: 0;
padding-bottom: 48.6px;
}
}
}
</style>